Sign in to follow this  
Followers 0
king-b-

Restart scriipt.

2 posts in this topic

What i want to do is add a command that when i press F7 it will start back over from While 1 without waiting the 60 seconds at the end of the script. Is there any way to add that or di i have to rewrite the code fully?

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused, $t
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F8}", "Showme")  

;;;; Body of program would go here;;;;
While 1
    If $t = 1 Then
        Send("{s down}");presses the s button and holds it
        Sleep(5800);waits for 5800 milliseconds/5.8 sec
        Send("{s up}");releases s button
        MouseClick("left",205,531);leftclicks at the coordinates x=205,y=531
        MouseClick("left",538,554);leftclicks at the coordinates x=205,y=531
    MouseClick("left",538,555);leftclicks at the coordinates x=205,y=531
    MouseClick("left",538,553);leftclicks at the coordinates x=205,y=531s
    Sleep(60 * 1000)
    EndIf
    Sleep(10)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func Showme()
    If $t = 0 Then
        $t = 1
        Return
    EndIf
    If $t = 1 Then
        $t = 0
        Return
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused, $t, $Start
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F8}", "Showme")
HotKeySet('{F7}', '_F7Restart')

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
    If Not $Start Then _Body()
WEnd
;;;;;;;;

Func _Body()
    $Start = Not $Start
    While $Start
        If $t = 1 Then
            Send("{s down}");presses the s button and holds it
            Sleep(5800);waits for 5800 milliseconds/5.8 sec
            Send("{s up}");releases s button
            MouseClick("left",205,531);leftclicks at the coordinates x=205,y=531
            MouseClick("left",538,554);leftclicks at the coordinates x=205,y=531
            MouseClick("left",538,555);leftclicks at the coordinates x=205,y=531
            MouseClick("left",538,553);leftclicks at the coordinates x=205,y=531s
            $iTime = TimerInit()
            Do
                Sleep(10)
            Until TimerDiff($iTime) / 1000 >= 60 Or Not $Start
        EndIf
        Sleep(10)
    WEnd
    Return 1
EndFunc

Func _F7Restart()
    $Start = Not $Start
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func Showme()
    If $t = 0 Then
        $t = 1
        Return
    EndIf
    If $t = 1 Then
        $t = 0
        Return
    EndIf
EndFunc


[center]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.[/center]

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