Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

mouse mapping problems

  • Please log in to reply
1 reply to this topic
  • Members
  • 1 posts
  • Last active: Mar 18 2004 05:30 PM
  • Joined: 18 Mar 2004
i'm trying to map a key to the mouse's right button, so i can have a hotkey for bringing up the right-click context menu. that seems simple, but i'm having no luck. first i tried

!r:: ; alt-r
MouseClick, right, 100, 150
MsgBox, finished

the mouse cursor moves to the top-left area of my active window and then the message box appears, but nothing else.

i also tried

!r:: ; alt-r
MsgBox, finished

the message appears but nothing else. my keyboard doesn't have a Windows key so i'm not sure this would work anyway. i make sure my mouse is over the active window in case that matters, but it doesn't appear to.

help appreciated!

  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
You're on the right track, I think all you have to do is remove the coordinates from the MouseClick command so that the cursor's current position is used. And don't display the MsgBox because that will make the menu vanish. Try this:

!r:: ; alt-r
MouseClick, right

Your idea of sending {APPSKEY} is even be better because it doesn't require you to position the mouse cursor before using the hotkey. But keep in mind that some apps do not support the AppsKey as an alternative to a right-click (though Explorer and other MS software all probably do).

Unfortunately, it seems that having the Alt key physically down disrupts the {AppsKey}. This appears to be a property of the OS itself. To work around this, you could put in a Sleep to give yourself time to release the alt key:

Sleep, 500 ; User must release the Alt key within this time.

Or consider using Ctrl-R or Ctrl-Alt-A for the hotkey such as below:


If you're not running Win9x, you can get fancier and use Capslock as a modifier key like this:

#InstallKeybdHook ; This line is needed due to a bug I just discovered.
Capslock & a::

In the above, you hold down CapsLock then press the 'A' key (the state of the capslock key will not be toggled when it is used to modify a hotkey).