Sign in to follow this  
Followers 0
Hendricius

Stupid question, starting the Code via Hotkey

7 posts in this topic

How is this possible.

I am completly new.

HotKeySet("b","beenden");

func beenden()

Exit

EndFunc

thats the function i use to exit the programm. It would be bether to just pause the programm. The second part: i need a function to continue running the programm. Help please :lmao:

thanks

Share this post


Link to post
Share on other sites



after you exit you cant start running the program again...


What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

this should work:

HotKeySet("{F9}", "TogglePause")
Global $PAUSED = False


While 1
    sleep(10)
    while ($PAUSED)
        sleep(100)
        ;The Code is paused.
    WEnd
    ;Put your normal code here
    
WEnd
Func TogglePause()
    if ($PAUSED == False) Then
        $PAUSED = True
    Else
        $Paused = False
    EndIf
EndFunc
oÝ÷ Ù©Ýiû¥ìZ^jëh×6
HotKeySet("{F9}", "TogglePause")
Global $PAUSED = False
GLobal $INT = 0
$d = GUICreate("Test")
$lab = GUICtrlCreateLabel("Not Paused", 10, 10)
$lab2 = GUICtrlCreateLabel($INT, 10, 40, 200)
GUISetState()
While 1
    sleep(10)
    while ($PAUSED)
        sleep(100)
        ;The Code is paused.
        if (GUICtrlRead($lab) == "Not Paused") Then GUICtrlSetData($lab, "Paused!")
        WEnd
        if (GUICtrlRead($lab) == "Paused!") Then GUICtrlSetData($lab, "Not Paused")
    ;Put your normal code here
    $INT += 1
    GUICtrlSetData($lab2, $INT)
WEnd
Func TogglePause()
    if ($PAUSED == False) Then
        $PAUSED = True
    Else
        $Paused = False
    EndIf
EndFunc
Edited by CHRIS95219

Share this post


Link to post
Share on other sites

after you exit you cant start running the program again...

yep. thats why i asked for a function that just pauses the programm and a function to start running the programm.

Share this post


Link to post
Share on other sites

; copy any you want to change  ;default value is listed firstPixel
WinActivate("Warcraft III")

HotKeySet("b","beenden");
HotKeySet("p", "TogglePause")


Global $PAUSED = False

While 1
    sleep(10)
    while ($PAUSED)
        sleep(100)

WEnd

Sleep(5000);
Send("!a");
Send("{F10}");
Send("!e");
Send("!q");
MouseClick("left",1018,942,1,1);
WEnd

func beenden()
    Exit
EndFunc

Func TogglePause()
    if ($PAUSED == False) Then
        $PAUSED = True
    Else
        $Paused = False
    EndIf
EndFunc

this is my code... The pause doesnt work.. Additionatly i would like the part

Sleep(5000);
Send("!a");
Send("{F10}");
Send("!e");
Send("!q");
MouseClick("left",1018,942,1,1);

to run as an infinite loop.

Thanks for your patience + help.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It works.. Its just that, the Sleep(5000), is keeping you from noticing.

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

It works.. Its just that, the Sleep(5000), is keeping you from noticing.

hehe sorry... but it keeps running.

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  
Followers 0