AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Switching Mouse buttons?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
NT
Guest





PostPosted: Sun Jul 31, 2005 8:54 pm    Post subject: Switching Mouse buttons? Reply with quote

Hello,

How do I create a script that switches mouse buttons (specifically, right and middle mouse buttons)?

I've tried two methods listed below without success. Any help would be appreciated--Thanks!

NT


Method 1:

*MButton::Send, {RButton}
*RButton::Send, {MButton}
return


Method 2:

#InstallMouseHook

GetKeyState, RButtonState, RButton
if RButtonState = D ; This check prevents the keyboard auto-repeat feature from auto-repeating the mouse button.
MouseClick, middle, , , 1, 0, D ; hold down middle mouse button.
return


GetKeyState, MButtonState, MButton
if MButtonState = D
MouseClick, Right, , , 1, 0, D
return
Back to top
Doo Dee



Joined: 23 Jul 2005
Posts: 14

PostPosted: Sun Jul 31, 2005 9:18 pm    Post subject: Reply with quote

This worked for me.

Code:
MButton::Send, {RButton}
RButton::Send, {MButton}
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Mon Aug 01, 2005 4:25 pm    Post subject: Reply with quote

To remap mouse buttons to each other while still retaining the ability to drag with the button, try the following. These examples use MouseClick instead of "Send {RButton up}" because the latter would prevent you from using modifier keys with the clicks (such as Shift+RightClick).

*RButton::MouseClick, middle, , , 1, 0, D ; Hold down the button.
*RButton up::MouseClick, middle, , , 1, 0, U ; Release the button.

*MButton::MouseClick, right, , , 1, 0, D ; Hold down the button.
*MButton up::MouseClick, right, , , 1, 0, U ; Release the button.
Back to top
View user's profile Send private message Send e-mail
NT



Joined: 31 Jul 2005
Posts: 2
Location: Seattle, WA USA

PostPosted: Tue Aug 02, 2005 10:20 pm    Post subject: Working... Reply with quote

Hello,

Well, I'm trying to remap the rocker switch on my Wacom pen. The pen is programmed to be a right click on the lower switch, and middle mouse on the upper switch. Strangely, the script doesn't seem to work on the Wacom. That makes me think the Wacom isn't a true "mouse click," so I have to figure out how to capture the input in AHK. Any suggestions?

Thanks for the help!

---NT
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Wed Aug 03, 2005 12:10 am    Post subject: Reply with quote

You might try using the steps at the bottom of the key list page (section "Special Keys") to see if your pen's mouse clicks are detectible by the program. Ensure that the script you use for testing has the mouse hook installed (which can be forced via #InstallMouseHook).
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group