Jump to content

Simple "mouse coordinate click" loop request


Recommended Posts

First off: I don't know how to code, or any coding languages, so I'm going to be explaining this in layman's terms, please bear with it. I can at least usually figure out most problems given an example and alot of time but this is puzzling me.

What I have:

I made a simple script to click on the screen at certain coordinates with Au3Record. Works fine in the single iteration it runs. However, I want it to continuously run after I start it, whether when I'm away from my computer for an hour or all day, and be able to be stopped when I get back so I can actually use my computer again. I know this would require some form of loop command in the code. I looked at some examples of different type of loop commands here but it's all Greek to me at this point. The "Do...Until" seems to be the one that would be what I want but I couldn't begin to figure out how to get the "Until" part to work.

Before coming here I had made a shortcut to the script on my desktop and had one of the click command lines to double click to shortcut to ghetto loop it, but its stalling after a while. And to stop my ghetto loop I simply had an empty notepad minimized that would be on top of the shortcut I could just alt+tab to real quick that would eventually stop it once it got to the end.

What I'd like:

Hopefully someone bored and nice enough to provide a simple loop command for a series of mouse clicks that will run "indefinitely" that even my computer illiterate mother can stop when I want control of my computer again.

Thanks in advance, and sorry if my lack of coding skills disturbs you, lol

What the Au3Recorder saved for me with a little time tweaking:

#region ---Au3Recorder generated code Start (v3.3.7.0) ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc

#endregion --- Internal functions Au3Recorder End ---

_WinWaitActivate("[s](window clicks are desired on)[/s]","")
MouseClick("left",1352,451,1)
Sleep (2000)
MouseClick("left",1250,421,1)
Sleep (2000)
MouseClick("left",1324,371,1)
Sleep (2000)
MouseClick("left",1216,333,1)
Sleep (2000)
MouseClick("left",1132,385,1)
Sleep (2000)
MouseClick("left",726,493,1)
Sleep (2000)
MouseClick("left",618,501,1)
Sleep (2000)
MouseClick("left",568,571,1)
Sleep (2000)
MouseClick("left",640,635,1)
Sleep (2000)
MouseClick("left",708,669,1)
Sleep (2000)
MouseClick("left",816,701,1)
Sleep (2000)
MouseClick("left",922,677,1)
Sleep (2000)
MouseClick("left",986,631,1)
Sleep (2000)
MouseClick("left",908,581,1)
Sleep (2000)
MouseClick("left",972,519,1)
Sleep (2000)
MouseClick("left",880,503,1)
Sleep (2000)
MouseClick("left",824,533,1)
Sleep (2000)
MouseClick("left",802,621,1)
Sleep (2000)
_WinWaitActivate("Program Manager","")
Sleep (2000)
MouseClick("left",22,1023,2)
#endregion --- Au3Recorder generated code End ---
Link to comment
Share on other sites

#region ---Au3Recorder generated code Start (v3.3.7.0) ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc

#endregion --- Internal functions Au3Recorder End ---
HotkeySet("{ESC}","_Exit") ;---------------------------------------------------------------<<<<<<
_WinWaitActivate("[s](window clicks are desired on)[/s]","")
While 1 ; ----------------------------------------------------------------------------------------<<<<<<
MouseClick("left",1352,451,1)
Sleep (2000)
MouseClick("left",1250,421,1)
Sleep (2000)
MouseClick("left",1324,371,1)
Sleep (2000)
MouseClick("left",1216,333,1)
Sleep (2000)
MouseClick("left",1132,385,1)
Sleep (2000)
MouseClick("left",726,493,1)
Sleep (2000)
MouseClick("left",618,501,1)
Sleep (2000)
MouseClick("left",568,571,1)
Sleep (2000)
MouseClick("left",640,635,1)
Sleep (2000)
MouseClick("left",708,669,1)
Sleep (2000)
MouseClick("left",816,701,1)
Sleep (2000)
MouseClick("left",922,677,1)
Sleep (2000)
MouseClick("left",986,631,1)
Sleep (2000)
MouseClick("left",908,581,1)
Sleep (2000)
MouseClick("left",972,519,1)
Sleep (2000)
MouseClick("left",880,503,1)
Sleep (2000)
MouseClick("left",824,533,1)
Sleep (2000)
MouseClick("left",802,621,1)
Sleep (2000)
_WinWaitActivate("Program Manager","")
Sleep (2000)
MouseClick("left",22,1023,2)
WEnd ; -------------------------------------------------------------------------------------------<<<<<<
#endregion --- Au3Recorder generated code End ---

Func _Exit() ;------------------------------------------------------------------------------------<<<<<<
Exit
EndFunc

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...