Sign in to follow this  
Followers 0
reilley

Newbie wants to do repetitive mouse clicks...

10 posts in this topic

Good day!

I am a new user of AutoIt v3 and would like to use this program to automate a "Refresh" mouse button in an application that times out after no activity. The app has a refresh button that I have used the AutoIt Window feature to identify, but what I would like to do is to click on this button every few minutes or so in order to keep activity going so the application doesn't time out. I didn't know if AutioIt can do this by itself without the need for a macro generator, but I would appreciate ANY advice from you guys out there that are power-users. I have searched the forum using keywords such as "timer", but nothing ovious is hitting me!

Thank you in advance for your suggestions and assistance!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

By the way, to run a script doing other stuff in the meantime (meaning, when unable to use Sleep() to pause your script), you can either use something like TimerInit() and then wait in the rest of the script loops for the TimerDiff() (=time interval since timerinit) to reach a certain value, or use the Adlib (search the help) functionality to execute a function every xxx time.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

damn, edited my first reply instead of adding to it. Sorry! Hope you got the original one in the mail. Now got to go, if you want i'll reconstruct it later.

Cheers


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Yes, I would like to see an example if you don't mind and have the time!!! Thank you so much!

Share this post


Link to post
Share on other sites

Yes, I would like to see an example if you don't mind and have the time!!! Thank you so much!

It is best expirience when you wrote program yourself, without examples.

Post us a snippet so we know whats all about.

i542


I can do signature me.

Share this post


Link to post
Share on other sites

For this example I am just going to pretend to want to prevent the screen saver from coming on (after 15 minutes or whatever) as it sounds similar to your prob.

Just make something that click every 10 seconds.

Mouseclick("left")

Sleep(10000)

And run this each time you need too


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I tried this code before the last couple of responses (and thank you for those!) and so far it seems to work, but I will test further.

MouseClick ( "left", 487, 957, 1, 0)

Opt("MouseClickDelay", 600000) ;10 minutes

The customer has the time-out set for 15 minutes, so I figured a refresh of 10 minutes would do the job. The interesting part is - I don't see the mouse to that position. Is this activated in the bakground so you wouldn't see the mouse change positions?

Edited by reilley

Share this post


Link to post
Share on other sites

OK, so I think that the option for MouseClick Delay means if your # of clicks is more than 1, this is the amount of time between each click. The Sleep command seems to probably be the best choice, but how do I make this execute every ten minutes? Is this a loop process that has to be created that runs continuously???

Share this post


Link to post
Share on other sites

Twitch the mouse:

$Twitch = 0
While 1
    $TwitchFactor = 100 + (200 * ($Twitch * -1))
    MouseMove(MouseGetPos(0) + $TwitchFactor, MouseGetPos(1) + $TwitchFactor)
    Sleep(5 * 1000) ; 5sec delay
    $Twitch = Not $Twitch
WEnd

Edit the Sleep() for the time you want.

:shocked:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Wow, that one is really cool - and I figured out how to shorten the distance the cursor moves. Thank you! I am going to test this within the application and see how it works out!

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