derblub Posted September 17, 2007 Posted September 17, 2007 hi - im new to autoit and i got allready a question how to change the button-text in a loop? i got a start button - if i click it, it changes the caption to stop - but if i click again, it stays on stop.. can someone help me please? my code sofar Dim $buttontext = "start" $startbutton = GuiCtrlCreateButton ($buttontext,110,50,70,20) GuiSetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $startbutton Then If $buttontext = "start" Then GUICtrlSetData($startbutton, "stop") Else If $buttontext = "stop" Then GUICtrlSetData($startbutton, "start") EndIf EndIf EndIf WEnd thx in advance
Valuater Posted September 17, 2007 Posted September 17, 2007 #include <GUIConstants.au3> Dim $buttontext = "start" GUICreate("") $startbutton = GUICtrlCreateButton($buttontext, 110, 50, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $startbutton Then If GUICtrlRead($startbutton) = "start" Then GUICtrlSetData($startbutton, "stop") Else GUICtrlSetData($startbutton, "start") EndIf EndIf WEnd 8)
derblub Posted September 17, 2007 Author Posted September 17, 2007 great!!! thx gui constants and gui itself where allready there, i only forgot to copy them into the code but with the ctrlread it works flawless now!! many thx for this fast answer!!
Valuater Posted September 17, 2007 Posted September 17, 2007 Welcome!! ... thats what they pay me for ...lol 8) BTW: Welcome to the Autoit Forums!
Moderators SmOke_N Posted September 17, 2007 Moderators Posted September 17, 2007 Welcome!!... thats what they pay me for ...lol8)BTW: Welcome to the Autoit Forums!Over paid or Under worked? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
derblub Posted September 17, 2007 Author Posted September 17, 2007 its a bit difficult to learn the syntax - but i think im gonna love autoit for dev - a great "little" tool it is! (and looks like a nice community too )
Moderators SmOke_N Posted September 17, 2007 Moderators Posted September 17, 2007 its a bit difficult to learn the syntax - but i think im gonna love autoit for dev - a great "little" tool it is! (and looks like a nice community too )The syntax is quite easy actually... a bit more logical than others I've played with IMHO. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now