Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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 ?

Posted (edited)

$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.

Posted (edited)

#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
Posted (edited)

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.

Posted (edited)

Posted Image

That's the error I'm getting with your edited script, but mines is similar or it says something about pause. not being right.

Edited by Orcc
Posted

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?

Posted

you missed #cs somewhere above line 13

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

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
×
×
  • Create New...