Jump to content
Sign in to follow this  
UltraFine

GUICtrlCreateEdit() and GUICtrlSetData() Question and Problem

Recommended Posts

UltraFine

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
If Not FileExists("C:\Folder\MyFile.txt") Then
    GUICtrlSetData($Edit1, "File Not Found, can not continue.")
Else
    GUICtrlSetData($Edit1, "File Found, Starting...")
EndIf
If ProcessExists("ProcessName.exe") Then
    GUICtrlSetData($Edit1, "Can not Continue Please Close The Program.")
Else
    GUICtrlSetData($Edit1, "Program successfully closed.")
EndIf
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    GUICtrlSetData($Edit1, "Please keep this program Active and don't minimize.")
Else
    GUICtrlSetData($Edit1, "window found active.")
EndIf   
GUICtrlSetData($Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

i want it to be like this.

Posted Image

but it always clears the first text and shows something like this.

Posted Image

Maybe i am using a wrong Control for this GUICtrlCreateEdit() or a wrong function for setting text GUICtrlSetData().

any other way to do this?

Please help me to Solve my Problem. thanks

Edited by L0veUK

Share this post


Link to post
Share on other sites
bogQ

Maybe i am using a wrong Control for this GUICtrlCreateEdit() or a wrong function for setting text GUICtrlSetData().

any other way to do this?

Please help me to Solve my Problem. thanks

GUICtrlRead($Edit1) can help but probably you beter use

$mylist = GUICtrlCreateList("*** End ***", 8, 8, 289, 129,$WS_VSCROLL+$LBS_DISABLENOSCROLL+$LBS_NOSEL )

with the

_GUICtrlListBox_InsertString($mylist,"text", 0)

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Andreik

This is an option:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $TEMP
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
$TEMP = GUICtrlRead($Edit1)
If Not FileExists("C:\Folder\MyFile.txt") Then
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "File Not Found, can not continue.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "File Found, Starting...")
EndIf
$TEMP = GUICtrlRead($Edit1)
If ProcessExists("ProcessName.exe") Then
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Can not Continue Please Close The Program.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Program successfully closed.")
EndIf
$TEMP = GUICtrlRead($Edit1)
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Please keep this program Active and don't minimize.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "window found active.")
EndIf
$TEMP = GUICtrlRead($Edit1)
GUICtrlSetData($TEMP & @CRLF & $Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

When the words fail... music speaks

Share this post


Link to post
Share on other sites
UltraFine

This is an option:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $TEMP
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
$TEMP = GUICtrlRead($Edit1)
If Not FileExists("C:\Folder\MyFile.txt") Then
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "File Not Found, can not continue.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "File Found, Starting...")
EndIf
$TEMP = GUICtrlRead($Edit1)
If ProcessExists("ProcessName.exe") Then
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Can not Continue Please Close The Program.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Program successfully closed.")
EndIf
$TEMP = GUICtrlRead($Edit1)
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Please keep this program Active and don't minimize.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "window found active.")
EndIf
$TEMP = GUICtrlRead($Edit1)
GUICtrlSetData($TEMP & @CRLF & $Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
hi Andriek, Thanks for the quick help but this time it stops on first text.

run it.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $TEMP
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
$TEMP = GUICtrlRead($Edit1)
If Not FileExists(@WindowsDir & "\Notepad.exe") Then
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "File Not Found, can not continue.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "File Found, Starting...")
EndIf
$TEMP = GUICtrlRead($Edit1)
If ProcessExists("Explorer.exe") Then
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Can not Continue Please Close The Program.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Program successfully closed.")
EndIf
$TEMP = GUICtrlRead($Edit1)
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "Please keep this program Active and don't minimize.")
Else
    GUICtrlSetData($TEMP & @CRLF & $Edit1, "window found active.")
EndIf
$TEMP = GUICtrlRead($Edit1)
GUICtrlSetData($TEMP & @CRLF & $Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Derak

You need to use _GUICtrlEdit_AppendText (#Include <GuiEdit.au3>) and some @LFs.

Here is the code to it:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
If Not FileExists("C:\Folder\MyFile.txt") Then
    _($Edit1, "File Not Found, can not continue.")
Else
    _GUICtrlEdit_AppendText($Edit1, "File Found, Starting..." & @LF )
EndIf
If ProcessExists("ProcessName.exe") Then
    _GUICtrlEdit_AppendText($Edit1, "Can not Continue Please Close The Program." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "Program successfully closed."& @LF)
EndIf
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    _GUICtrlEdit_AppendText($Edit1, "Please keep this program Active and don't minimize." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "window found active." & @LF)
EndIf   
_GUICtrlEdit_AppendText($Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by Derak

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Share this post


Link to post
Share on other sites
UltraFine

GUICtrlRead($Edit1) can help but probably you beter use

$mylist = GUICtrlCreateList("*** End ***", 8, 8, 289, 129,$WS_VSCROLL+$LBS_DISABLENOSCROLL+$LBS_NOSEL )

with the

_GUICtrlListBox_InsertString($mylist,"text", 0)

can you provide me a example?

Share this post


Link to post
Share on other sites
bogQ

#include <WindowsConstants.au3>
#Include <GuiListBox.au3>

$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateList("", 8, 8, 289, 129,$WS_VSCROLL+$LBS_DISABLENOSCROLL+$LBS_NOSEL )

If Not FileExists("C:\Folder\MyFile.txt") Then
    _GUICtrlListBox_InsertString($Edit1,"File Not Found, can not continue.", -1) 
Else
    _GUICtrlListBox_InsertString($Edit1,"File Found, Starting...", -1) 
EndIf

If ProcessExists("ProcessName.exe") Then
    _GUICtrlListBox_InsertString($Edit1,"Can not Continue Please Close The Program", -1) 
Else
    _GUICtrlListBox_InsertString($Edit1,"Program successfully closed.", -1) 
EndIf

If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    _GUICtrlListBox_InsertString($Edit1,"Please keep this program Active and don't minimize.", -1) 
Else
    _GUICtrlListBox_InsertString($Edit1,"window found active.", -1) 
EndIf

_GUICtrlListBox_InsertString($Edit1,"*** End ***", -1) 
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

>_>


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
UltraFine

You need to use _GUICtrlEdit_AppendText (#Include <GuiEdit.au3>) and some @LFs.

Here is the code to it:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
If Not FileExists("C:\Folder\MyFile.txt") Then
    _($Edit1, "File Not Found, can not continue.")
Else
    _GUICtrlEdit_AppendText($Edit1, "File Found, Starting..." & @LF )
EndIf
If ProcessExists("ProcessName.exe") Then
    _GUICtrlEdit_AppendText($Edit1, "Can not Continue Please Close The Program." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "Program successfully closed."& @LF)
EndIf
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    _GUICtrlEdit_AppendText($Edit1, "Please keep this program Active and don't minimize." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "window found active." & @LF)
EndIf   
_GUICtrlEdit_AppendText($Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
thanks for the help but this time it writes all the text in one line like

File Not Found, can not continue.Program successfully closed.Please keep this program Active and don't minimize.*** End ***

and i want it to write like

File Not Found, can not continue.
Program successfully closed.
Please keep this program Active and don't minimize.
*** End ***

Share this post


Link to post
Share on other sites
Derak

thanks for the help but this time it writes all the text in one line like

File Not Found, can not continue.Program successfully closed.Please keep this program Active and don't minimize.*** End ***

and i want it to write like

File Not Found, can not continue.
 Program successfully closed.
 Please keep this program Active and don't minimize.
 *** End ***
You've probably got my first code (without @LF)

I've just edited it 4 min ago :mellow:

It should work now ^^

[Edit]

There:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
If Not FileExists("C:\Folder\MyFile.txt") Then
    _GUICtrlEdit_AppendText($Edit1, "File Not Found, can not continue." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "File Found, Starting..." & @LF )
EndIf
If ProcessExists("ProcessName.exe") Then
    _GUICtrlEdit_AppendText($Edit1, "Can not Continue Please Close The Program." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "Program successfully closed."& @LF)
EndIf
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    _GUICtrlEdit_AppendText($Edit1, "Please keep this program Active and don't minimize." & @LF)
Else
    _GUICtrlEdit_AppendText($Edit1, "window found active." & @LF)
EndIf   
_GUICtrlEdit_AppendText($Edit1, "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by Derak

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Share this post


Link to post
Share on other sites
bogQ

_GUICtrlEdit_AppendText($Edit1, "File Not Found, can not continue." & @LF)

sry Derak but i still dont think that thats best solution becose it can set visible @LF char on end of line

im still on my apinion on exsample that i geaved up there that its better list to use in this case then edit.


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
UltraFine

GUICreate("For You!",220,60,-1,-1,0x40000)
_GUICtrlCreateMarquee("Thanks a Lot For The Help!",5,5,210,24,0xFFFF00)
GUICtrlSetResizing(-1,1)
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func _GUICtrlCreateMarquee($_MarText,$_MarX,$_MarY,$_MarWidth,$_MarHeight,$_MarBGColor=-1,$_MarLoop=-1,$_MarBehavior=-1,$_MarDirection=-1,$_MarScrollAmount=-1,$_MarScrollDelay=-1)
    Local $_MarString="<marquee width=100% height=100%"
    If $_MarLoop <> -1 Then $_MarString&=" loop="&$_MarLoop
    If $_MarBehavior <> -1 Then $_MarString&=" behavior="&$_MarBehavior
    If $_MarDirection <> -1 Then $_MarString&=" direction="&$_MarDirection
    If $_MarScrollAmount <> -1 Then $_MarString&=" scrollamount="&$_MarScrollAmount
    If $_MarScrollDelay <> -1 Then $_MarString&=" scrolldelay="&$_MarScrollDelay
    $_MarString &= ">"&$_MarText&"</marquee>"
    Local $_marIE = ObjCreate("Shell.Explorer")
    Local $_marReturn = GUICtrlCreateObj($_marIE,$_MarX,$_MarY,$_MarWidth,$_MarHeight)
    $_marIE.navigate("about:blank")
    $_marIE.document.body.topmargin=0
    $_marIE.document.body.leftmargin=0
    $_marIE.document.body.scroll="no"
    $_marIE.document.body.bgcolor=$_MarBGColor
    $_marIE.document.body.innerHTML = $_MarString
    $_marIE=0
    Return $_marReturn
EndFunc

Share this post


Link to post
Share on other sites
Andreik

@L0veUK

Sorry, my bad. Try this:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $TEMP
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("GUI", 306, 146, Default, Default)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 289, 129)
$TEMP = GUICtrlRead($Edit1)
If Not FileExists("C:\Folder\MyFile.txt") Then
    GUICtrlSetData($Edit1,"File Not Found, can not continue.")
Else
    GUICtrlSetData($Edit1,$TEMP & @CRLF & "File Found, Starting...")
EndIf
$TEMP = GUICtrlRead($Edit1)
If ProcessExists("ProcessName.exe") Then
    GUICtrlSetData($Edit1,$TEMP & @CRLF &  "Can not Continue Please Close The Program.")
Else
    GUICtrlSetData($Edit1,$TEMP & @CRLF &  "Program successfully closed.")
EndIf
$TEMP = GUICtrlRead($Edit1)
If Not WinActive($Form1, "") Then
    WinActivate($Form1, "")
    GUICtrlSetData($Edit1,$TEMP & @CRLF &  "Please keep this program Active and don't minimize.")
Else
    GUICtrlSetData($Edit1,$TEMP & @CRLF &  "window found active.")
EndIf
$TEMP = GUICtrlRead($Edit1)
GUICtrlSetData($Edit1,$TEMP & @CRLF & "*** End ***")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

When the words fail... music speaks

Share this post


Link to post
Share on other sites
Derak

sry Derak but i still dont think that thats best solution becose it can set visible @LF char on end of line

im still on my apinion on exsample that i geaved up there that its better list to use in this case then edit.

"set visible @LF char on end of line" lol

What about the " & " there???

The last code I've showed is working perfectly as required :mellow:

And No @LF is supposed to show up. You didn't even try the code when you said that. ^^


[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Share this post


Link to post
Share on other sites
UltraFine

@L0veUK

Sorry, my bad. Try this:

;in previous post
no need to say sorry!

thanks for the help.

Share this post


Link to post
Share on other sites
BrettF

Share this post


Link to post
Share on other sites
bogQ

"set visible @LF char on end of line" lol

What about the " & " there???

And No @LF is supposed to show up. You didn't even try the code when you said that. ^^

dont woory i tryed before posting :mellow:

Posted Image

it shud b @CRLF same as Andreik in his script

maby i formed my coment on your script wrong and maby it sunded litle like im atacking you 4 your work :( sry if it did sounded like that , English isnt my home language :)

Respect ;)


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Derak

Posted Image

it shud b @CRLF same as Andreik in his script

maby i formed my coment on your script wrong and maby it sunded litle like im atacking you 4 your work :mellow: sry if it did sounded like that , English isnt my home language :(

Respect ;)

I didn't think of you as attaking my work :)

I respect every opinion and user I see. I didn't know about this @LF showing in >.<

Now I understand what you meant ^^

Yeah, I guess @CRLF is much better ;)

< Respect >


[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×