Sign in to follow this  
Followers 0
Guest Samjabr

Proof Please

7 posts in this topic

Hi, this is a script I wrote to repeat some obnoxious repetious actions. Sadly, I had to write repetious obnoxious lines...I'm a noob. I am sure there was a better way to do this.

Anyway, I'm not sure why I get an error running it. It says something related to myLoop. Can anyone give me an idea what I'm doing wrong? Thanks.

Sleep, 10000

myLoop

MouseClick("left", 312, 80, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

MouseClick("left", 346, 78, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

MouseClick("left", 379, 82, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

MouseClick("left", 411, 80, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

MouseClick("left", 472, 80, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

MouseClick("left", 502, 80, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

MouseClick("left", 538, 80, 2)

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 247, 270, 2)

MouseClick("left", 247, 270, 2)

Sleep, 500

MouseClick("left", 292, 276, 2)

MouseClick("left", 292, 276, 2)

Sleep, 2000

MouseClick("left", 731, 54, 2)

Sleep, 2000

myLoop

Share this post


Link to post
Share on other sites



Hey dude, you should read the help file about loops. Your sleep syntax should be:

Sleep( "500" )

Commas were used in the previous version of autoit. If you wanted this to loop over and over forever, you could start your code with:

While 1

and let the last line of your code be:

Wend

That will loop your script over and over. Erase MyLoop alltogether

Share this post


Link to post
Share on other sites

Thanks, I guess I should read more :whistle:

I understand the new commands. The annoying thing now is I used the spy and took the x,y coords of the window. But for some reason when I run it, it is not clicking where it should be. Even though like I said, I took the coords with WindowSpy and I wrote down the right ones. hmmm

Well thanks for your help.

Share this post


Link to post
Share on other sites

Look at Opt( "MouseCoordMode" ) in help

Share this post


Link to post
Share on other sites

Example of using a function to do your clicks.

I noticed your patern

Sleep( 10000)
;myLoop
while 1
clicker(312)
clicker(346)
clicker(379)
clicker(411)
clicker(472)
clicker(502)
clicker(538)
wend
;myLoop 

func clicker($x)
MouseClick("left", $x, 80, 2)
MouseClick("left", 247, 270, 2)
MouseClick("left", 247, 270, 2)
Sleep(500)
MouseClick("left", 247, 270, 2)
MouseClick("left", 247, 270, 2)
Sleep(500)
MouseClick("left", 292, 276, 2)
MouseClick("left", 292, 276, 2)
Sleep(2000)
MouseClick("left", 731, 54, 2)
Sleep(2000)
endfunc

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Howdie, I know how you feel, the whole "noob" thing, hehe. This is what you want (at least it looks like it to me):

Opt( "MouseCoordMode" = 0 )

That will make your mouse coordinates work in the window you are working with.

Share this post


Link to post
Share on other sites

Batch, you mean Opt( "MouseCoordMode", 0)

Look at "AutoItSetOption" in the help file and scroll down to the very bottom :whistle:

Samjabr, unless the script is game related, there are probably easier ways to accomplish what you want (using the "Send" command).

Hope that helps


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
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
Sign in to follow this  
Followers 0