Sign in to follow this  
Followers 0
illya

MouseSetOnEvent UDF - Windows not registering mouseklicks

3 posts in this topic

Hi i've been trying to create a AutoIt that is supposed to:

1) Send("^!r")

2) wait untill I have pressed something with the main mousebutton

3) then Send("^!r") again

the problem: It doesnt allow windows to register the mouseclick.

Lets say Send("^!r") makes a menu popup, when I then klick on a link on that menu, it performs Send("^!r") again and the menu is gone. But the menu never registered that I klicked on it. And I want it to register that.

In other words: The script registers the mouseclicks, but no other application.

#include <MouseSetOnEvent_UDF.au3>

Send("^!r")   ;press ctrl+alt+r
_MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "MousePrimaryUp_Event")   ;Listen for mouseUp and then call MousePrimaryUp_Event
Sleep(6000)   ;how long the AutoIt should stay up in case I dont click anything

Func MousePrimaryUp_Event()
    Sleep(100)     ;I tried to do this to enable the links to sense the mouseUp before Send("^!r") performed
    Send("^!r")    ;press ctrl+alt+r
   ; Here im gonna find a way to shut down the AutoIt
EndFunc

I did have another post about this, but since the topic was about something else I thought it was better to create a new. :D

Share this post


Link to post
Share on other sites



Hi i've been trying to create a AutoIt that is supposed to:

1) Send("^!r")

2) wait untill I have pressed something with the main mousebutton

3) then Send("^!r") again

the problem: It doesnt allow windows to register the mouseclick.

Lets say Send("^!r") makes a menu popup, when I then klick on a link on that menu, it performs Send("^!r") again and the menu is gone. But the menu never registered that I klicked on it. And I want it to register that.

In other words: The script registers the mouseclicks, but no other application.

#include <MouseSetOnEvent_UDF.au3>

Send("^!r")  ;press ctrl+alt+r
_MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "MousePrimaryUp_Event")  ;Listen for mouseUp and then call MousePrimaryUp_Event
Sleep(6000)  ;how long the AutoIt should stay up in case I dont click anything

Func MousePrimaryUp_Event()
    Sleep(100)    ;I tried to do this to enable the links to sense the mouseUp before Send("^!r") performed
    Send("^!r")   ;press ctrl+alt+r
  ; Here im gonna find a way to shut down the AutoIt
EndFunc

I did have another post about this, but since the topic was about something else I thought it was better to create a new. :D

EDIT: SOLVED:

Using ControlClick I was able to get rid of the problem, by making ControlClick click again.

#include <MouseSetOnEvent_UDF.au3>

$i = 0
$a = 0

Send("^!r")

_MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "MousePrimaryUp_Event")

While $i <= 20
    $i = $i + 1
    If $i = 21 Then     
        If $a = 0 Then
            Send("^!r")
        EndIf
    EndIf
    If $i <= 20 Then
        Sleep(200)
    EndIf
WEnd

Func MousePrimaryUp_Event()
    ControlClick ( "RocketDock", "", "" )
    Sleep(100)
    Send("^!r")
    $i = 20
    $a = 1
EndFunc

The only problem now is a little nasty focus-problem where the window the link opens looks like it has focus, but in fact doesnt. Anyway the big problem is solved

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