Jump to content

Check for mouse down


Go to solution Solved by mikell,

Recommended Posts

Does anyone know of a way to check whether a mouse button is currently being pressed?

I have an application that I need to push out (some in-house thing that came from one of the overseas parent company offices. They think we want to sit down at each of hundreds of stations and do this manually.) that has an all graphic install interface (no detectable controls :ranting:  :censored:  :mad2: ), so I have to use mouse clicks to automate it.  The trouble is, that users keep trying to do other things durring the install.

As long as they are not pressing a mouse button, I can record their current mouse position, click where I need to, then put the mouse back.  If they have a button down when my script does a click, then things go out of whack.

Any ideas?

Edited by willichan
Link to comment
Share on other sites

  • Moderators

Why not disable input with BlockInput, maybe put up a splash screen to let the end user know?

Edit: Sorry, missed the part where you said no Control functions, mouse only...

Edited by JLogan3o13

"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

JLogan3o13:  That may be what I will have to do if I can't detect the mouse button.  It will cause a large number of complaints I would rather avoid, but it wouldn't be the first time I have had to take the heat for something forced down from the mother ship.

Edited by willichan
Link to comment
Share on other sites

 

?

#include <Misc.au3>
While 1
    For $i = 1 to 6
       If _IsPressed($i) Then msgbox(0,"", "a mouse button is pressed")
    Next
    Sleep(10)
WEnd

That worked!  Thanks.

I just have to make sure to skip button 3.  That seems to match ctrl-break.

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