Keegaroo Posted June 5, 2020 Share Posted June 5, 2020 (edited) Been dorking around with Autoit for about a week and this language is the first i've ever even attempted to learn and i'm really loving all the cool automation that is possible with this languie. In no, shape, or form am I an expert as you'll see below from my very basic code. I've made a basic outline of this very basic script I am trying to make and it works flawlessly, only issue is I want this script to run until I press a hotkey. How would I go about making a start and a stop hotkey for a whole script? WinActivate("Runner") sleep(250) MouseClick("left",957,590) Sleep(5500) MouseClick("left",951,637) Sleep(3500) MouseClick("left",939,585) sleep(2500) MouseClick("left",1037,568) Sleep(6750) MouseClick("left",1036,572) Sleep(2000) MouseClick("left",951,472) Sleep(3750) MouseClick("left",927,501) Sleep(7250) MouseClick("left",780,584) Sleep(4000) Edited June 5, 2020 by Keegaroo Link to comment Share on other sites More sharing options...
Musashi Posted June 5, 2020 Share Posted June 5, 2020 7 minutes ago, Keegaroo said: WinActivate("Runner") Is this a game ? "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Keegaroo Posted June 5, 2020 Author Share Posted June 5, 2020 No, isn't posting automation about gaming not allowed? Link to comment Share on other sites More sharing options...
Musashi Posted June 5, 2020 Share Posted June 5, 2020 (edited) 1 hour ago, Keegaroo said: How would I go about making a start and a stop hotkey for a whole script? Here a simulation with MouseMove : expandcollapse popup; Press Esc to terminate script, Pause/Break to "pause" Global $g_bPaused = False HotKeySet("{PAUSE}", "_TogglePause") HotKeySet("{ESC}", "_Terminate") HotKeySet("+!d", "_StartScript") ; Shift-Alt-d While True Sleep(100) WEnd Func _TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>_TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate Func _StartScript() ToolTip("Script is running > move mouse to 10,100", 0, 0) MouseMove(10, 100) Sleep(2000) ToolTip("move mouse to 200,200", 0, 0) MouseMove(200, 200) Sleep(2000) ToolTip("move mouse to 400,200", 0, 0) MouseMove(400, 200) Sleep(2000) ToolTip("move mouse to 600,300", 0, 0) MouseMove(600, 300) Sleep(2000) ToolTip("", 0, 0) EndFunc ;==>_StartScript Quote No, isn't posting automation about gaming not allowed? Automation or script interaction with games or game servers, regardless of the game, is not allowed. Edited June 5, 2020 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
careca Posted June 5, 2020 Share Posted June 5, 2020 @Musashi's script works well because it basically traps the flow of the script at any time, meaning you can pause between actions in a function. There are some cases where you may need that the script continues and not be stuck in a loop like that, for those cases you can go with something like this: Global $g_bPaused = 1 HotKeySet("{F2}", "_TogglePause") HotKeySet("{ESC}", "_Terminate") While 1 If $g_bPaused = 0 Then ;Stuff EndIf WEnd Func _TogglePause() If $g_bPaused = 0 Then $g_bPaused = 1 ToolTip('Script is "Paused"', 0, 0) Else $g_bPaused = 0 ToolTip('Script is "Running"', 0, 0) EndIf Sleep(1000) ToolTip("") EndFunc ;==>_TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate It's different in that, the loop keeps going and other things may still work, if you have them in the main loop, but this would not stop in the middle of the action, it would only pause at the end of the actions, i hope i can get the message across, sometimes is difficult to me. Musashi 1 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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