Vlad_1996 Posted May 5, 2018 Share Posted May 5, 2018 (edited) Hello world, Here's the script, a simple loop with 3 diff pieces that repeat themselves over the loop. Shift + ` pauses the script. Now, due to some inconveniences not anticipated earlier, I can't let this run in the background and click on its own, I'd be more safe to have it sleeping until I press a hotkey, then the 1st piece executes and script is paused until I press the same hotkey once more, then the 2nd piece executes... and so on, after the 3rd piece is executed, the loop starts with the 1st piece again. So I need to kind of reverse the pause function - when I start it, it sleeps until the key is pressed. Ofc, the sleep part will be set to like 10ms or so, will play with it later. Can you guys help with that? Thank you in advance. expandcollapse popupGlobal $Paused = False HotKeySet("+`", "TogglePause") Func TogglePause() $Paused = Not $Paused While $Paused = True Sleep(100) WEnd EndFunc While 1 $pos=MouseGetPos() MouseClick("left",424,126,3,0) Send("{DEL}") MouseClick("left",424,126,3,0) Send("{DEL}") Send("{1}") Send(".") Send("{0}") Send("{1}") MouseClick("left",424,116,1,0) MouseClick("left",475,295,1,0) MouseMove($pos[0],$pos[1],0) Send("{ALTDOWN}") Send("{TAB}") Sleep(100) Send("{TAB}") Send("{ALTUP}") Sleep (60000) MouseClick("left",424,126,3,0) Send("{DEL}") MouseClick("left",424,126,3,0) Send("{DEL}") Send("{1}") Send(".") Send("{0}") Send("{2}") MouseClick("left",424,116,1,0) MouseClick("left",475,295,1,0) MouseMove($pos[0],$pos[1],0) Send("{ALTDOWN}") Send("{TAB}") Sleep(100) Send("{TAB}") Send("{ALTUP}") Sleep (60000) MouseClick("left",424,126,3,0) Send("{DEL}") MouseClick("left",424,126,3,0) Send("{DEL}") Send("{1}") Send(".") Send("{0}") Send("{3}") MouseClick("left",424,116,1,0) MouseClick("left",475,295,1,0) MouseMove($pos[0],$pos[1],0) Send("{ALTDOWN}") Send("{TAB}") Sleep(100) Send("{TAB}") Send("{ALTUP}") Sleep (60000) WEnd Edited May 5, 2018 by Melba23 Added correct code tags Link to comment Share on other sites More sharing options...
Nessie Posted May 5, 2018 Share Posted May 5, 2018 Something like that? expandcollapse popupGlobal $iIndex = 1 Global $fPaused = True HotKeySet("+`", "TogglePause") While 1 If $fPaused = True Then ContinueLoop EndIf $aPos = MouseGetPos() Switch $iIndex Case 1 MouseClick("left", 424, 126, 3, 0) Send("{DEL}") MouseClick("left", 424, 126, 3, 0) Send("{DEL}") Send("{1}") Send(".") Send("{0}") Send("{1}") MouseClick("left", 424, 116, 1, 0) MouseClick("left", 475, 295, 1, 0) MouseMove($aPos[0], $aPos[1], 0) Send("{ALTDOWN}") Send("{TAB}") Sleep(100) Send("{TAB}") Send("{ALTUP}") Sleep(60000) _IncrementIndex() Case 2 MouseClick("left", 424, 126, 3, 0) Send("{DEL}") MouseClick("left", 424, 126, 3, 0) Send("{DEL}") Send("{1}") Send(".") Send("{0}") Send("{2}") MouseClick("left", 424, 116, 1, 0) MouseClick("left", 475, 295, 1, 0) MouseMove($aPos[0], $aPos[1], 0) Send("{ALTDOWN}") Send("{TAB}") Sleep(100) Send("{TAB}") Send("{ALTUP}") Sleep(60000) _IncrementIndex() Case 3 MouseClick("left", 424, 126, 3, 0) Send("{DEL}") MouseClick("left", 424, 126, 3, 0) Send("{DEL}") Send("{1}") Send(".") Send("{0}") Send("{3}") MouseClick("left", 424, 116, 1, 0) MouseClick("left", 475, 295, 1, 0) MouseMove($aPos[0], $aPos[1], 0) Send("{ALTDOWN}") Send("{TAB}") Sleep(100) Send("{TAB}") Send("{ALTUP}") Sleep(60000) _IncrementIndex() EndSwitch WEnd Func _IncrementIndex() If $iIndex >= 3 Then $iIndex = 1 Else $iIndex += 1 EndIf TogglePause() EndFunc ;==>_IncrementIndex Func TogglePause() $fPaused = Not $fPaused While $fPaused = True Sleep(100) WEnd EndFunc ;==>TogglePause My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s). My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all! My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file Link to comment Share on other sites More sharing options...
Vlad_1996 Posted May 5, 2018 Author Share Posted May 5, 2018 Nessy, it works like charm. Exactly what I would hope for. I love you) 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