jmoney Posted August 6, 2009 Share Posted August 6, 2009 (edited) So I have written a small script, but I would like to add the ability to pause it when I press a particular key. Then Unpause it when i press the key again. Here is the script so far. While 1 Sleep(300) $var = PixelGetColor( 637, 446 ) If $var = 0x55291B Then Send("{4}") If $var = 0x3B0C08 Then Send("{2}") If $var = 0x967928 Then Send("{9}") If $var = 0x7B0000 Then Send("{d}") If $var = 0x1C0500 Then Send("{5}") If $var = 0xF1CC7B Then Send("{0}") If $var = 0x4A292C Then Send("{a}") If $var = 0xCD5113 Then Send("{3}") If $var = 0xB597DA Then Send("{F3}") WEnd TIA Edited August 6, 2009 by jmoney Link to comment Share on other sites More sharing options...
nekkutta Posted August 6, 2009 Share Posted August 6, 2009 So I have written a small script, but I would like to add the ability to pause it when I press a particular key. Then Unpause it when i press the key again. Here is the script so far. While 1 Sleep(300) $var = PixelGetColor( 637, 446 ) If $var = 0x55291B Then Send("{4}") If $var = 0x3B0C08 Then Send("{2}") If $var = 0x967928 Then Send("{9}") If $var = 0x7B0000 Then Send("{d}") If $var = 0x1C0500 Then Send("{5}") If $var = 0xF1CC7B Then Send("{0}") If $var = 0x4A292C Then Send("{a}") If $var = 0xCD5113 Then Send("{3}") If $var = 0xB597DA Then Send("{F3}") WEnd TIA Try this: Global $boolPause = True HotKeySet("{PAUSE}" , "SetPause" While 1 Sleep(300) If $boolPause Then $var = PixelGetColor( 637, 446 ) If $var = 0x55291B Then Send("{4}") If $var = 0x3B0C08 Then Send("{2}") If $var = 0x967928 Then Send("{9}") If $var = 0x7B0000 Then Send("{d}") If $var = 0x1C0500 Then Send("{5}") If $var = 0xF1CC7B Then Send("{0}") If $var = 0x4A292C Then Send("{a}") If $var = 0xCD5113 Then Send("{3}") If $var = 0xB597DA Then Send("{F3}") EndIf WEnd Func SetPause() $boolPause = Not $boolPause EndFunc [size="2"] "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan[/size] Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 6, 2009 Share Posted August 6, 2009 (edited) Taken from HotKeySet example in docs Global $Paused HotKeySet("{PAUSE}", "TogglePause") ;;;; Body of program would go here ;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc<br>Change the key to whatever suits your need<br> Edited August 6, 2009 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now