alanzarb Posted May 8, 2018 Share Posted May 8, 2018 HotKeySet ("{ENTER}", "Start") HotKeySet ("{ESC}", "_Paused") While 1 Sleep(250) WEnd Func Start() While 1 $pxs = PixelSearch(0,0,1919.1078,959.541,0x01FF00) If isArray($pxs) then MouseMove($pxs[0],$pxs[1], 0) MouseClick("Left") EndIf WEnd EndFunc Func _Paused() Paused EndFunc Obrigado desde já!!! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 8, 2018 Moderators Share Posted May 8, 2018 @alanzarb I have moved your thread to the proper forum; please pay attention to where you post in the future. Each forum tells you what it is for at the top. Per your question, can you explain more about what app you're trying to automate? There is doubtless a better way to do this. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
alanzarb Posted May 8, 2018 Author Share Posted May 8, 2018 Thanks, and I'm sorry, I do not know how to read in English.! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 8, 2018 Moderators Share Posted May 8, 2018 Use Google Translate if you need, but help us help you by providing more information. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
seandisanti Posted May 9, 2018 Share Posted May 9, 2018 just have a control variable in your loop, and have your hotkey function (pause) toggle that value. HotKeySet ("{ENTER}", "Start") HotKeySet ("{ESC}", "_Paused") While 1 Sleep(250) WEnd Func Start() $notPaused = true While 1 $pxs = PixelSearch(0,0,1919.1078,959.541,0x01FF00) If isArray($pxs) and $notPaused then MouseMove($pxs[0],$pxs[1], 0) MouseClick("Left") EndIf WEnd EndFunc Func _Paused() $notPaused = !$notPaused EndFunc syntax may be wrong, but that's what you're going for. I haven't kept up with this language in a while, so i'm not sure if you can do !$notPaused like that, but if not you can just do an if $notPaused then $notPaused = false else $notPaused = true endif or whatever alanzarb 1 Link to comment Share on other sites More sharing options...
Bilgus Posted May 9, 2018 Share Posted May 9, 2018 (edited) 1 hour ago, seandisanti said: just have a control variable in your loop, and have your hotkey function (pause) toggle that value. HotKeySet ("{ENTER}", "Start") HotKeySet ("{ESC}", "_Paused") While 1 Sleep(250) WEnd Func Start() $notPaused = true While 1 $pxs = PixelSearch(0,0,1919.1078,959.541,0x01FF00) If isArray($pxs) and $notPaused then MouseMove($pxs[0],$pxs[1], 0) MouseClick("Left") EndIf WEnd EndFunc Func _Paused() $notPaused = !$notPaused EndFunc syntax may be wrong, but that's what you're going for. I haven't kept up with this language in a while, so i'm not sure if you can do !$notPaused like that, but if not you can just do an if $notPaused then $notPaused = false else $notPaused = true endif or whatever Where is the functionality for once notPaused = true?? Edit: Ah nevermind I see where you made it not update Mouse Move.. Something like this.. expandcollapse popupGlobal Enum $iState_None = 0, $iState_Paused = 1, $iState_Running = 2 Global $iState = $iState_None Global $sDots = "." HotKeySet("{ENTER}", _Start) HotKeySet("{ESC}", _Pause) While True ;Endless loop Sleep(250) WEnd Func _Start() If $iState = $iState_None Then ;Keeps start from being called multiple times $iState = $iState_Running While True ;Endless loop While $iState = $iState_Running ;Loop for running state $pxs = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xFFFFFF) If IsArray($pxs) And $iState = $iState_Running Then MouseMove($pxs[0], $pxs[1], 0) ;MouseClick("Left") EndIf WEnd While $iState = $iState_Paused ;Sit in a loop for paused state $sDots &= "." If StringLen($sDots) > 10 Then $sDots = "." ToolTip("Paused" & $sDots) ;Tooltip @ cursor position Sleep(250) WEnd ToolTip("") ;Erases tooltip WEnd ElseIf $iState = $iState_Paused Then _Pause() ;Could toggle the state here as well EndIf EndFunc Func _Pause() If $iState <> $iState_None Then ;Not running yet disable Pause... If $iState = $iState_Paused Then $iState = $iState_Running ToolTip("Running") ;Tooltip @ cursor position Else $iState = $iState_Paused EndIf EndIf EndFunc Edited May 9, 2018 by Bilgus alanzarb 1 Link to comment Share on other sites More sharing options...
alanzarb Posted May 9, 2018 Author Share Posted May 9, 2018 Thank you Seandisanti is even more Bilgus! (: Link to comment Share on other sites More sharing options...
seandisanti Posted May 9, 2018 Share Posted May 9, 2018 No problem, glad to help. 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