Jump to content

how to pause my script


lawpapa
 Share

Recommended Posts

  • Moderators

I would like to find a solution for pauseing my script by pressing a certain key on the keyboard

Does anyone know something about it ?

Pls dont recommend me the pause/break key. or tell me why it does not work by my comp ^^

Ty in advance

L.-

Ok, how about we tell you to read the "Help" file under HotKeySet, and there is a perfect "Pause" example right there for the copying.

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.

Link to comment
Share on other sites

I would like to find a solution for pauseing my script by pressing a certain key on the keyboard

Does anyone know something about it ?

Pls dont recommend me the pause/break key. or tell me why it does not work by my comp ^^

Ty in advance

L.-

Look at the example for HotKeySet in the help files.

Edit - Great minds think alike!!!

Edited by BigDod


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

I often use a twin combination of hotkey sets to do the pausing and resuming if I manually require to pause a script. If you think about it, pausing is only half of what you need, you'll also need to resume execution at some point.

You could always define a hotkey set which does the pausing. Chose a key combination that doesn't conflict with other applications that you might be running, say esc key (this will conflict with many other progs) i.e

somewhere at the beginning of the script

HotKeySet ( "{esc}" , "pauser" )

HotKeySet ( "{f1}" , "resumer" )

Global $var

somewhere in the execution of your script

Func pauser()

$var=0

while $var=0

sleep (250)

wend

endfunc

I haven't tested this but it might work.

and somewhere else something like

Func resumer()

$var=1

endfunc

Link to comment
Share on other sites

I often use a twin combination of hotkey sets to do the pausing and resuming if I manually require to pause a script. If you think about it, pausing is only half of what you need, you'll also need to resume execution at some point.

You could always define a hotkey set which does the pausing. Chose a key combination that doesn't conflict with other applications that you might be running, say esc key (this will conflict with many other progs) i.e

somewhere at the beginning of the script

HotKeySet ( "{esc}" , "pauser" )

HotKeySet ( "{f1}" , "resumer" )

Global $var

somewhere in the execution of your script

Func pauser()

$var=0

while $var=0

sleep (250)

wend

endfunc

I haven't tested this but it might work.

and somewhere else something like

Func resumer()

$var=1

endfunc

The example in the help file pauses and resumes.


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

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