Jump to content

Recommended Posts

Posted

I'm trying to build a script that -- only when it's briefly activated -- will intercept right mouse clicks that would normally be received and acted upon by a browser application. Here's what I'm using as the basis for my script:

#include <ScreenCapture.au3>
#include <Misc.au3>
ProcessSetPriority(@AutoItPID, 4)
Sleep(4000)                     ; delay to allow user to select proper browser window
$dll = DllOpen("user32.dll")
While 1
Sleep (10)
If _IsPressed("01", $dll) Then
MsgBox(0,"_IsPressed", "Left Pressed",2)
EndIf
If _IsPressed("02", $dll) Then
MsgBox(0,"_IsPressed", "Right Pressed",2)
EndIf
If _IsPressed("23", $dll) Then
MsgBox(0,"_IsPressed", "End Key Pressed")
ExitLoop
EndIf
WEnd
DllClose($dll)
Exit

As shown by the screen shot below, the script receives notification of the click, but the click is also acted upon by the browser. How can I block transfer of that same click to the browser? I would only want this blocking to occur while my script is active.

Thanks in advance for any help

P.S. I'm not certain of my terminology in describing what I'm trying to achieve, so if anyone has a suggestion for stating the problem in clearer terms, please chime in.

post-29172-1221629167_thumb.png

Posted

Hi.

1.) Welcome to the forum :)

What about

MouseClick("Left", 1)
?
2.) BTW: Your first post was somehow -- well -- amuzing >_< :idiot:

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Posted

2.) BTW: Your first post was somehow -- well -- amuzing >_< :idiot:

Not to mention, provide a test case to enhance the "Community On Patrol" bot :)
Posted

Here's an UDF that I think works that way:

http://www.autoitscript.com/forum/index.php?showtopic=64738

Thanks very much. I do think it will be able to provide the blocking I need.

However, in trying to follow how the UDF works, the following script steps are a bit too advanced for me at this point:

For $i = 1 To $aMouse_Events[0][0]
            If $aMouse_Events[$i][0] <> $iEvent Then
                $aTmp_Mouse_Events[0][0] += 1
                ReDim $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]+1][5]
                $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][0] = $aMouse_Events[$i][0]
                $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][1] = $aMouse_Events[$i][1]
                $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][2] = $aMouse_Events[$i][2]
                $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][3] = $aMouse_Events[$i][3]
                $aTmp_Mouse_Events[$aTmp_Mouse_Events[0][0]][4] = $aMouse_Events[$i][4]
            EndIf
        Next

I would greatly appreciate it if someone could briefly describe what they are accomplishing.

Thanks.

Posted

In addition to the above question, I have encountered a problem in trying to utilize the suggested UDF.

_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "MouseSecondaryUp_Process")

My MouseSecondaryUp_Process function gets called properly by the SecondaryUp Event, however, the mouse up event is also passed along to the external application. How can I prevent that? If I've intercepted and processed the mouse click, I don't want the application to do it also.

Thanks for any help.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...