Sign in to follow this  
Followers 0
savage29

simple mouse function script

8 posts in this topic

hi guys, im new to this so i would like some simple starter help. i have read thru the help files already and still i am unsure of what im doing wrong.

i am trying to write a script that simply repeats a mouseclick for a few hours once every 5 seconds in the same position on screen. all i have garnered so far from the help files is ->

MouseClick ( "right" [ 963, 677 [, 10000 [, 50]]])

and its not working lol. do i need any extra code there? if someone could just write it for me without explaining it, i would appreciate it because then i can work backwards and figure out for myself how to do similar things.

thanks :graduated:

Share this post


Link to post
Share on other sites



MouseClick ( "right" [ 963, 677 [, 10000 [, 50]]])

should be

MouseClick ( "right", 963, 677, 10000, 50)

the [] shown in the help file simply indicates the value is optional and isn't required for the command to work


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

lol ok ill take out the brackets and hope it runs, but question is will that just run indefinetly on a loop or???

Share this post


Link to post
Share on other sites

Hello savage29,

First, I'd like to Welcome you to the AutoIt Forums :graduated:

As for MouseClick() it is a function meant to perform once only. If you want it to loop. look at looping functions like Do...Until, While....Wend.

Realm


My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ok its doing exactly what i wanted it to :graduated: now i need to search around on how to end the program by moving the mouse manually. can you awesome people point me in the right direction?

oh and thankyou kaotk and realm :(

Edited by savage29

Share this post


Link to post
Share on other sites

you could try something along the lines of:

MouseMove(963,677)

Do

$pos = MouseGetPos()

MouseClick ( "right")

Until $pos[0]<>963 or $pos[1]<>677

That is just a very basic and is definately not foolproof.

The better option would be to set a hotkey (see HotKeySet in the helpfile)

to create a hotkey to start and stop the code.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

now i need to search around on how to end the program by moving the mouse manually.

I really don't know of a way to end it by moving the mouse manually, However, look at HotKeySet() The example alone is perfect for you needs. You can register HotKeys upon your script startup and it has an example function to exit script when a hotkey(s) is/are pressed. It also has an example pause function which may be more useful to pause script, so u can utilize your keybord and mouse for a moment, then same hotkey(s) will also unpause returning the script to its previous function.

Realm

Edit: oops had window open to long, and did'nt see kaotbliss already gave you that answer.

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

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