Sign in to follow this  
Followers 0
ceslayer

Script randomly clicks screen when I don't want it

11 posts in this topic

Hi all, first post on the forum here. I don't know much about AutoIt scripting, but with the help of my cousin (meaning I basically just looked on) we've thrown together a pretty simple script. All it does is click a few areas of the screen at different times, as well as pressing some keys. We have it running on two computers, and it works perfectly on one. However, on the other computer, when the script says to right click a coordinate, it does, but then randomly left clicks in the middle of the screen, which exits the right click menu that we want. It then clicks the coordinates of an option on the right click menu (which is what it is supposed to do, but the right click menu isn't there anymore because of the random left click in the middle of the screen). The weird thing is, is that sometimes this doesn't happen and it works perfectly, without changing anything at all. Does anyone know a reason as to why it randomly clicks the middle of the screen, and only in between the right click and the left click on the menu? Thanks

Share this post


Link to post
Share on other sites



Make sure the screen resolution is the same on both machines. Screen coordinates on one resolution are different on another.

Share this post


Link to post
Share on other sites

I've made the screen resolutions the same, as well as just manually changing the coordinates using the WindowInfo tool, but no dice. The coordinates are fine, its just that it's like it's reading a part of the script that just isn't there when it clicks the middle of the screen.

Share this post


Link to post
Share on other sites

If you didn't capture the click sequence and coordinates with ScriptWriter, you might want to do so and compare its output with what's in your script. Also, try increasing the time between clicks. I've had lots of issues where click timing was the problem.

Share this post


Link to post
Share on other sites

I just captured all the coordinates with the scriptwriter, and they were more or less the same. The time in between the right click and the (supposed to be on the right click menu) left click is 2 seconds. Surely the timing can't be the problem. It's just frustrating because nowhere in the script does it say to left click the middle of the screen, especially not in between the right click and left click commands. I do appreciate the help though.

Share this post


Link to post
Share on other sites

Does the ScriptWriter generated code behave the same way?

Share this post


Link to post
Share on other sites

Is there a way for it to record the pause time in between my clicks? Because that would be the only way for me to check, because in the script there are varying pause times (some 2 seconds, some 90 seconds, some a half hour...)

Share this post


Link to post
Share on other sites

Another thing to try is using key sequences rather than mouse clicks, if your app will let you do so. Alt and the first letter of the menu item will sometimes work even if letters in the menu name aren't underlined. I almost always use key strokes rather than mouse clicks for navigating from within a script.

Share this post


Link to post
Share on other sites

There is no way to record a pause that I'm aware of. You can use the sleep() function if pause time is predictable. But, I think it's better to capture what's going on with the screen in a loop and watch for an indicator heralding the next step.

Share this post


Link to post
Share on other sites

I just said screw it and just did the entire script using ScriptWriter and then adding in the pause times. I should have done this before, but I actually had no idea the scriptwriter existed until you mentioned it, so thank you very much for all of your help, seems like this place is a great community.

Share this post


Link to post
Share on other sites

Glad I could help.

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