LiquidWarlock Posted July 1, 2005 Posted July 1, 2005 Ok, so i have a script like this: Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") and so on, and i have the Hotkeys in there to pause it..but it will not allow me to pause in the middle of those. I am making an script to continually press z for a game, but i want F6 to pause it. It pauses at any other time after the pressing of Z's and before, but they main function is to press Z, and i need to be able to pause it. Any help will be greatly appreciated.
Valuater Posted July 1, 2005 Posted July 1, 2005 straight from beta help ; Press Esc to terminate script, Pause/Break to "pause" Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc this should do the trick 8)
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 @LiquidWarlockCan you be more explicit on this:but it will not allow me to pause in the middle of thoseLike what exactly your trying to accomplish?@ValuaterThat's in the regular version of AutoIt too 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.
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 @LiquidWarlockCan you be more explicit on this:Like what exactly your trying to accomplish?@ValuaterThat's in the regular version of AutoIt too<{POST_SNAPBACK}>Well yeah i have all of what he said in my script, but i want to be able to pause the script at any given time inbetween those Z's. like i cannot randomly press F6 (my pause button) to pause the script, although if its before or after the Z's it pauses fine
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 (edited) maybe i could post my script, or tell what i want it to do and someone can write me one to show me what i am trying to do.. it is a very small script so shouldnt be bad. Because even though you guys are giving me a lot of help, im not exactly sure what to do with the help given Edited July 1, 2005 by LiquidWarlock
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 (edited) If you post your code, maybe we can assist you more. I'm going to read this post for the 3rd time to see if I can decipher it, but your code would speed things up tremendously.Right now it's like reading between the lines (that's like staring at the middle finger) Edited July 1, 2005 by ronsrules 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.
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 (edited) Hmm here it is: Woops.. Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d Run ("notepad.exe") Sleep (2000) Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") Send("Z") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc Edited July 1, 2005 by LiquidWarlock
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 sorry not sure how you do the code thing...to post it like you guys do. I am always looking through these forums, but decided to register today
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 There is not much to the script, that is not what i want it for, but that is how i am testing, using notepad. But it wont pause. And the GUI was so hard for me that i just took it out o.O
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 sorry not sure how you do the code thing...to post it like you guys do. I am always looking through these forums, but decided to register today<{POST_SNAPBACK}>[code]then; your code[/code]the above ] brackets go next tot he "e" (not where they are now) 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.
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 [code]then; your code[/code]the above ] brackets go next tot he "e" (not where they are now)<{POST_SNAPBACK}>Thanks test
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 Ok, I was testing a "test" script, and racking my brain to see what I could do to help. I am under the firm belief you have to use a UDF that I'm not sure on how to write the script: _IsPressed() So I'm assuming and I'm sure I will be corrected: Send("Z") If _IsPressed() = 1 Then; I'm sure I'm way off ; Waiting for "unpause" Endif Send("Z") If _IsPressed() = 1 Then; I'm sure I'm way off ; Waiting for "unpause" Endif Etc... Etc... and so on 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.
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 Have to run to the store real quck: Try looking up in "search": _IsPressed 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.
LiquidWarlock Posted July 1, 2005 Author Posted July 1, 2005 Have to run to the store real quck:Try looking up in "search":Â _IsPressed<{POST_SNAPBACK}>says no topics found
Valuater Posted July 1, 2005 Posted July 1, 2005 (edited) This will do what you want I tested it #include <GuiConstants.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 Send("Z") sleep(20) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc your welcome 8) Edited July 1, 2005 by Valuater
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 says no topics found<{POST_SNAPBACK}>Here is the UDF I believe for it: _IsPressed 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.
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 This will do what you wantI tested it#include <GuiConstants.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While 1 Send("Z") sleep(20) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFuncyour welcome8)<{POST_SNAPBACK}>So for my own benefit:He has a function going w/ all the "Send("Z")'s, and your saying that it will interrupt his current script w/ the togglepause() function? That a key pressed intervenes when a scripti is in motion or a function is in motion? I would imagine that it would have to wait till the end of the loop or function call before it took action itself. 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.
Valuater Posted July 1, 2005 Posted July 1, 2005 So for my own benefit:He has a function going w/ all the "Send("Z")'s, and your saying that it will interrupt his current script w/ the togglepause() function? That a key pressed intervenes when a scripti is in motion or a function is in motion? I would imagine that it would have to wait till the end of the loop or function call before it took action itself.<{POST_SNAPBACK}>First.. The "z"'s are sent in the "loop" not a function2nd.. yes it will interupt the script with the toggle/pause3rd.. the key will interupt a script/motion, but 4th.. not normally a function (it depends)5th... your right it does have to wait for the loop to complete, however, the loop is very-very short, thus appearing to stop it instantlyhope that helps8)
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 (edited) First.. The "z"'s are sent in the "loop" not a function2nd.. yes it will interupt the script with the toggle/pause3rd.. the key will interupt a script/motion, but 4th.. not normally a function (it depends)5th... your right it does have to wait for the loop to complete, however, the loop is very-very short, thus appearing to stop it instantlyhope that helps8)<{POST_SNAPBACK}>Sorry, none of my scripts are this short, and they all call to something else. I would of done something silly like this:expandcollapse popup#include <GuiConstants.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While WinExists("Your window title name") Sleep(500) Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif WEnd Func ContinueSend() While 1 Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif Send("Z") If _IsPressed('75') Then TogglePause() Endif WEnd ;Etc, if you want more sends EndFunc ;==>ContinueSend Func _IsPressed($hexKey) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc;==>_IsPressed Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd ContinueSend() EndFuncIs my logic flawed? Or am I just barking up the wrong tree?These examples don't help me know, but I can see how they would in the future!!EDIT: Would of put some Sleep(100) 's between the EndIf 's Edited July 1, 2005 by ronsrules 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.
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