Jump to content

Need Pause+ unpause key command


Recommended Posts

Hi i have a script but, every time i do something else i need to close it. is it possible to set a key to pause the script? if so plz send full command my current script is:

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.10.0

Author: Beta

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

HotKeySet("-", "Stop") ;script can be stopped by pressing 0

Sleep(4000) ;wait some time before starting the control+a cycle, to allow the user to navigate to the correct window

While 1 ;repeat endlessly

Send("{F1}") ;simluate f1 keypress

Sleep(800) ;wait 1 seconds

Send("{F1}") ;simluate f1 keypress

Sleep(800) ;wait 1 seconds

Send("{7}") ;simluate 7 keypress

Sleep(3000) ;wait 3 seconds

WEnd ;repeat

Func Stop() ;to allow the script to stop

Exit ;same

EndFunc ;same

Link to comment
Share on other sites

Look at the example for HotKeySet in the help file, it has a pause/unpause example.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Look at the example for HotKeySet in the help file, it has a pause/unpause example.

I have i can't get it to work right.

this is the new one i did but.. its not working when i press =

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.10.0

Author: Beta

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("-", "Stop") ;script can be stopped by pressing -

Sleep(4000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1 ;repeat endlessly

Send("{F1}") ;simluate f1 keypress

Sleep(800) ;wait .80 seconds

Send("{F1}") ;simluate f1 keypress

Sleep(800) ;wait 1 seconds

Send("{7}") ;simluate 7 keypress

Sleep(3000) ;wait 3 seconds

WEnd ;repeat

Func TogglePause()

$Paused = = $Paused

While $Paused

sleep(100)

WEnd

EndFunc

Func Stop() ;to allow the script to stop

Exit ;same

EndFunc ;same

can u adjust my script and post ?

Link to comment
Share on other sites

$Paused = = $Paused

should be $Paused = not $Paused

I believe this is just a typing mistake

Edited by muhmuuh

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Link to comment
Share on other sites

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.10.0

Author: Beta

Script Function:

Template AutoIt script.

#ce ----------------------------------------------------------------------------

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("-", "Stop") ;script can be stopped by pressing -

Sleep(4000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1 ;repeat endlessly

Send("{F1}") ;simluate f1 keypress

Sleep(800) ;wait .80 seconds

Send("{F1}") ;simluate f1 keypress

Sleep(800) ;wait 1 seconds

Send("{7}") ;simluate 7 keypress

Sleep(3000) ;wait 3 seconds

WEnd ;repeat

Func TogglePause()

$Paused = not $Paused

While $Paused

sleep(100)

WEnd

EndFunc

Func Stop() ;to allow the script to stop

Exit ;same

EndFunc ;same

i edited it but getting a error now? can someone review it and help edit the script?

Edited by Orcc
Link to comment
Share on other sites

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")

HotKeySet("-", "Stop") ;script can be stopped by pressing -

Sleep(4000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1 ;repeat endlessly
;Send("{F1}") ;simluate f1 keypress
;Sleep(800) ;wait .80 seconds
;Send("{F1}") ;simluate f1 keypress
;Sleep(800) ;wait 1 seconds
;Send("{7}") ;simluate 7 keypress
;Sleep(3000) ;wait 3 seconds
ToolTip("runing")
WEnd ;repeat
Func TogglePause()
$Paused = not $Paused
While $Paused
    ToolTip("paused")
sleep(100)
WEnd


EndFunc

Func Stop() ;to allow the script to stop
Exit ;same
EndFunc ;same

This works on my computer

Can you tell what the error is?

Edited by muhmuuh

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Link to comment
Share on other sites

From your screen shot I would guess that you copied too much text when you highlighted his code. Try starting from Global $Paused and commenting out EVERYTHING above that.

No thats not it.. I started at global. also... someone find a answr?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...