Sign in to follow this  
Followers 0
Garanator

MouseUp MouseDown help

2 posts in this topic

Opt("TrayIconHide", 1)

While 1

Sleep(100)

WEnd

While 2

If MouseDown("right") Then MouseUp("right")

WEnd

I'm trying to block my right mouse button from being pushed... What am I doing wrong?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

One problem you were having is that your code provided no way to exit the first infinite loop that began with While 1

Another problem was that there was no way to exit your script.

Lastly, the function MouseDown("right") emulates a mouse right-click and when it is successful, always returns 1 which is interpreted as True, in your code. But there is a way to disable the right-click context menu over an Internet Explorer object, which I found on the AutoIt forums here, but I didn't go looking for it to put it into the following "improved" version of your code:

Opt("TrayIconHide", 1)
HotKeySet("{F9}","ExitMod"); hit F9 function key to exit
Sleep(100)
While 2
    Sleep(50)
;If MouseDown("right") Then MouseUp("right")
WEnd
Func ExitMod()
    Exit
EndFunc

There might be a way to remap a mouse right-click, but it is something rarely used - google it.

Edit 1: Well I got curious and made the following script, which works intermittently:

#include <Misc.au3>
Opt("TrayIconHide", 1)
HotKeySet("{F9}","ExitMod"); hit F9 key to exit
Sleep(100)
;
$user32HDL = DllOpen("user32.dll")
Sleep(800)
;
While 1
    Sleep(12)
    If _IsPressed(02, $user32HDL) Then
        Left_ClickMe()
    EndIf
WEnd
Func Left_ClickMe()
    Send("{ESC}")
    $pos = MouseGetPos()
    Sleep(20)
    $x = $pos[0] - 30
    $y = $pos[1] - 30
    MouseMove($x, $y, 0)
    Send("{ESC}")
    Sleep(40)
    MouseClick("left")
    MouseMove($pos[0], $pos[1], 0)
    Send("{ESC}")
EndFunc
Func ExitMod()
    DllClose($user32HDL)
    Sleep(300)
    Exit
EndFunc

I should probably be shot several times for even suggesting this method.

Edited by Squirrely1

Das Häschen benutzt Radar

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