Jump to content
Sign in to follow this  
mc83

change caption of a button

Recommended Posts

mc83

hello guys.

I'm trying to write a autoclicker, and i want to have a pause/resume button, that would change caption according to the state of the program. What i mean is it should first say "Pause" and when you click it, it should change to "Resume". (and viceversa)

is there any way to do that? (i have looked through the documentation & searched the forums, but wasn't able to find anything useful)

thank you :whistle:

Share this post


Link to post
Share on other sites
SmOke_N

Maybe?

Global $bB1Change
$hGUI = GUICreate('MyGUI', 200, 70)
$B1 = GUICtrlCreateButton('Pause', 10, 10, 180, 50)
GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $B1
            $bB1Change = Not $bB1Change
            If $bB1Change Then
                GUICtrlSetData($B1, 'Resume')
            Else
                GUICtrlSetData($B1, 'Pause')
            EndIf
    EndSwitch
WEnd


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.

Share this post


Link to post
Share on other sites
mc83

oh... it appears i haven't looked deep enough through the documentation.

what i wanted to do can be done with

GUICtrlSetData (control ID, data)

Share this post


Link to post
Share on other sites
Dead_Man

i made a clone of klick0r awhile ago, hope this helps

#NoTrayIcon
MsgBox(0,"Klick0r","Klick0r by Dead_Man started!" & @LF & "How to use:" & @LF & "Press F5 = Close Klick0r" & @LF & "Press F9 = Rightklick Timer Enabled" & @LF & "Press F10 = Leftklick Timer enabled" & @LF & "Press F11 = All Timer disabled");                                                                                                                               
Global $Paused
Hotkeyset("{F5}", "Close")
Hotkeyset("{F9}", "Right")
HotKeySet("{F10}", "Left")
Hotkeyset("{F11}", "stop")

;---------------------------
;Klick0r
;---------------------------
;How to use:

;Press F5 = Close Klick0r

;Press F9 = Rightklick Timer enabled

;Press F10 = Leftklick Timer enabled

;Press F11 = All Timer disabled
;---------------------------
;OK   
;---------------------------

;~ ====== Start Of Main Loop ======
While 1
    Sleep(10000)
WEnd
;~ ====== End Of Main Loop ======

func Close()
    MsgBox(0,"Klick0r","Klick0r Closed")
    Exit 0
EndFunc

Func Right()
    While 1
        MouseClick("right")
    WEnd
EndFunc

Func Left()
    While 1
        MouseClick("Left")
    WEnd
EndFunc

Func stop()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc
Edited by Dead_Man

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  

×