Valuater Posted July 1, 2005 Posted July 1, 2005 using your code #include <GuiConstants.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While WinExists("Your window title name") Sleep(50) Send("Z") If _IsPressed('75') Then TogglePause() Endif WEnd 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() EndFunc ***** this should do the same thing ************ not tested********* 8)
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 I don't even have to run SciTE to see that this will run errors. 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 (edited) If you were trying to say that I put too many Send("Z")'s thanks:Revised, but please read:expandcollapse popup#include <GuiConstants.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") While WinExists("Your window title name") Send("Z") Sleep(100) If _IsPressed('75') Then TogglePause() Endif WEnd Func ContinueSend() While 1 Send("Z") Sleep(100) 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() EndFuncForgot the Sleeps again!! 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.
Valuater Posted July 1, 2005 Posted July 1, 2005 First and foremost... Please understand I am not here to attack anyone, my suggestions are humble, so please dont take anything offensive..ok 8) I dont know how to write this 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 We all have areas of expertise ( mine are few) 8) I played with your code.... and placed ";" where you do not need these in your script... hope thats ok 8) ........just suggestions I did test this... actually i am not sure where _isPressed() applies???? expandcollapse popup#include <GuiConstants.au3> Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Run("Notepad.exe") sleep(2000) While WinExists("Untitled - Notepad") Sleep(50) Send("Z") If _IsPressed('75') Then TogglePause() Endif WEnd ;Func ContinueSend() ; While 1 ; 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() EndFunc Func Terminate(); you left this one out Exit 0 EndFunc enjoy! 8)
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 Cool, now that makes sense. And no one took you offensively. You just post so much "help" file or other scripts, that it's hard sometimes to tell if you read the script. But this makes total sense. 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 @ ronrules Notice..... I put " Your welcome" on the completed script and how the last 10 post were just you and I .... thats how newbies are.... take it and run Not even a small note to thank you or I for our efforts 8)
Moderators SmOke_N Posted July 1, 2005 Moderators Posted July 1, 2005 LOL, I wrote the code he trimmed it, and he got the kudos ... Nah, just kidding ... I'm glad it's working for you. Nice catch Valuater 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 2, 2005 Author Posted July 2, 2005 LOL, I wrote the code he trimmed it, and he got the kudosĀ ...Nah, just kidding ... I'm glad it's working for you.Nice catch ValuaterĀ <{POST_SNAPBACK}>Oh Well, sorry. Thanks to both of you. and it works great, sorry about that ron
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