Jump to content

Mouseclick() works inconsistently?


IAMK
 Share

Recommended Posts

I have a script which I've been using for over a year, and now I'm seeing issues with it.
I originally attributed the issue to the system becoming laggy, so I added sleeps (even up to 1-second long, which is a long time). Hence, I don't believe the issue is lag. When I use my fingers for the touchscreen, or the mouse for manual click, it seem to work consistently.

Now, when I'm trying to debug the script, It runs the same line of code (it's the very first line of the script), but sometimes it clicks and sometimes it doesn't.
The code I'm having issues with is literally just MouseClick("primary", 50, 50, 1, 0) ;Close the video.

Note: I'm always running the script on the same program (which I am not restarting - but I have tried powercycling the system and it makes no difference), at the same screen, but the result is inconsistent.
Is there possibly some setting a computer/program can have which makes MouseClick() work inconsistantly, which I need to fix?

One thing I have tried is putting it in a loop. Then, when it doesn't work, it will keep pressing the same location every .5 seconds (but doesn't work).
I then use the touchscreen to touch another location, and after 1-5 attempts of the touch screen, the MouseClick() in the loop works (getting stuck later again until I use the touchscreen again).
Note: The movement of the mouse works 100% of the time. It's just the click that doesn't always work.

This is making my head explode.
Any help would be greatly appreciated.

Edited by IAMK
Link to comment
Share on other sites

  • Moderators

@IAMK How can we help you with your code when you don't post any?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

The code is literally just:

Global $file = FileOpen("LogScript.txt", 1)

;SCRIPT============================================================================================
FileWrite($file, _Now() & ": AUTOIT - Started." & @CRLF)

MouseClick("primary", 50, 50, 1, 0) ;Makes sure the video is closed.
Sleep(500)

Upon disabling my ToolTip, which was on MouseGetPos(0), MouseGetPos(1) (separate script), this code worked fine.

It seems there is some race condition happening with a ToolTip on top of the cursor and performing a mouseclick.
Not sure why that would be the case though.

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...