huldu Posted September 20, 2007 Share Posted September 20, 2007 Ive made a simple program that starts when the user clicks pause/break, it works perfectly. However im trying to figure out how to do a switch. When you click on pause/break the program starts, if you click it again it would stop, if you click it again it would start and so on. It got quite confusing and i just cant get it right no matter what i do atm... "I'm paper, rock is fine, nerf scissors!!!" Link to comment Share on other sites More sharing options...
enaiman Posted September 20, 2007 Share Posted September 20, 2007 Do a search for "pause script" or "unpause script" - this issue was discussed countless times and I'm sure you will get plenty of results. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
huldu Posted September 20, 2007 Author Share Posted September 20, 2007 Ill search for that, thanks I did come up with something tho, but is it a good way to do this on/off thing? HotKeySet("{PAUSE}", "Start") $a = 1 $b = 0 $c = 0 While 1 $a = 1 Do ToolTip("Started - Loops: " & $b,0,0) $b = $b + 1 Sleep(100) $c = 0 Until $a = 0 $a = 1 Do ToolTip("Stopped - Loops: " & $c,0,0) $c = $c + 1 $b = 0 Sleep(100) Until $a = 0 WEnd Func Start() $a = 0 EndFunc "I'm paper, rock is fine, nerf scissors!!!" Link to comment Share on other sites More sharing options...
enaiman Posted September 20, 2007 Share Posted September 20, 2007 It might work but there is a more efficient way ... got it straight from "pause" searchGlobal $Paused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "_Quit") While 1 If $Paused Then Sleep(100) ToolTip('Script is "Paused"', 0, 0) Else ToolTip("") EndIf WEnd Func TogglePause() $Paused = Not $Paused EndFunc ;==>TogglePause Func _Quit() Exit EndFunc... CREDITS PsaltyDS ...post: http://www.autoitscript.com/forum/index.ph...64&hl=pause SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
AU3Newbie Posted September 21, 2007 Share Posted September 21, 2007 It might work but there is a more efficient way ... got it straight from "pause" searchFunc TogglePause() $Paused = Not $PausedEndFunc ;==>TogglePauseOK,That's what he needed. 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