Jump to content

Recommended Posts

Posted

Hi!

I've searched but couldn't find anything of value :unsure: Or it's just me that can't search for right things ^^

Well, need a code, so when I press ESC, the script will be paused, and when I press ESC again it'll be resumed! (Don't care if 1 button is for pause and 1 is for resume tbh)

Fast plz! :P

Posted

@gwee

Nobody will make it at your place, and this has ben asked a milion of times... :P

Search in this forum with Toggle Pause

Cheers, FireFox.

Posted

As it is nearly time to go home... and I am feeling magnanimous...

HotKeySet("{ESC}", "_Terminate")
HotKeySet("{Pause}", "_Pause")

While 1
    Sleep(100) ; usually a good idea to put this in so you dont max your cpu
    ToolTip("Press ESC to quit")
    ;
    ; The stuff you want the script to do over and over again goes here
    ;
WEnd

Func _Terminate()
    Exit 0
EndFunc   ;==>_Terminate

Func _Pause()
    If Not IsDeclared("isPaused") Then Global $isPaused = False
    $isPaused = Not $isPaused
    While $isPaused
        Sleep(100)
    WEnd
EndFunc   ;==>_Pause

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Posted

As it is nearly time to go home... and I am feeling magnanimous...

HotKeySet("{ESC}", "_Terminate")
HotKeySet("{Pause}", "_Pause")

While 1
    Sleep(100) ; usually a good idea to put this in so you dont max your cpu
    ToolTip("Press ESC to quit")
    ;
    ; The stuff you want the script to do over and over again goes here
    ;
WEnd

Func _Terminate()
    Exit 0
EndFunc   ;==>_Terminate

Func _Pause()
    If Not IsDeclared("isPaused") Then Global $isPaused = False
    $isPaused = Not $isPaused
    While $isPaused
        Sleep(100)
    WEnd
EndFunc   ;==>_Pause

Getting WEnd error. Got some "WHile"'s in the code!

Posted

I was intended as a stand alone example... not to be cut and pasted in your code somewhere or vice versa...

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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