Kevin Chandler

[Updated] Custom context menu functions you can add to mouse gestures (Gesture Context Menu Function).

Discussion created by Kevin Chandler on Feb 22, 2019

Updated 03/29/2019: Program changed to "Gesture Context Menu Function.exe", version 2.00 (was "Gesture-S Custom Context Shortcut.exe").

This was rewritten to allow running the menu items which don't have underlined letters by using menu numbers instead.

Underlined menu item letters are still acceptable. And if an underlined menu item letter exists (and it works), using letters is preferable to using numbers.


The menu numbers are the number of down arrow presses you make to land on your required menu item.

Right click to display the menu and count while you press the down arrow key.

For the top level context menu, counting starts at one.

If your menu item is for a sub-menu, oppress Enter and restart your down arrow counting. Note: on sub-menus, the first line item is selected, so sub-menu counting begins at zero.

Separate each sub-menu count number, add a "|" (as shown above in green). If it's just the top level menu then omit the "|" and just add the number. Menu depth is not limited.

The "9|1" example is for toggling jog ordinate. "Display Options" is 9th (starting at 1) and "Jog" is the #1 position (starting at 0):


Concerns when using menu numbers instead of menu letters:

  • Context menu contents may change, so you menu item's position may shift and ruin the macro
    • This is especially true when you customize a context menu
  • Menu numbers are slower since the utility is doin what you did to count your menu numbers: repeated down arrows and Enter
    • Since there are graphics updates involved, there's a chance the utility can outrun the menu navigation and end on the wrong menu item


Delay control (optional):

To throttle the pace of the utility, you can optionally increase the default delay time (50 milliseconds) by specifying an integer as the second command line parameter (like the yellow 75 above).

Although more applicable to menu numbers, this applies to letters or numbers.

Also, you can lower the delay (down to 20) to increase responsiveness.


Help dialog:

Run the utility without any command line parameters to display this (somewhat) helpful dialog:



Updated 03/19/2019: No program changes, just a notice:

Of late, for reasons unknown to me, the "d" for the "Display Options" context menu no longer responds to the "d" sent to it, rendering the current rendition of this utility useless for making these dimension changes (jog, add to ordinate, center, reference). Even odder, is that I have another utility where the jog ("d-j") does work, but the other "d" menus don't.

BTW, to see which letters are underlined in a context menu, select "Customize menu":




Some common functions, such as jogging an ordinate dimension, aren't available for gestures (or for keyboard shortcuts):


This utility allows you to add (most) context menu functions to your gestures.

For example, the gesture at 6 o'clock, with the kindergarten-quality "JO" icon, will toggle the jog state of an ordinate dimension (clicked on after you pick the gesture):

You choose which context menu functions you wish to add to your gestures.

To add a custom context gesture:

  1. From the attached zip file, copy "Gesture-S Custom Context Shortcut.exe" to a folder of your choice.
  2. Each custom context gesture runs by a macro, but don't be put off by this if you feel you're not up to macros.
    Bear with me, it's really simple.
  3. This is the macro that runs the JO gesture above.
    When you start a new macro, 3 of these 4 lines are inserted for you. The "Shell" line you add.
    But, here it is so you can just copy it:
    Shell "C:\SW Utilities\Gesture-S Custom Context Shortcut.exe d-j", vbNormalFocus
  4. For your macro, you'll need to change the path if your folder is different. Be sure to quote it as shown.
    Keep the menu letters, "d-j" that are within the quotes. I cover menu letters in a minute.
  5. That's the end of the programming part. Save the macro.
    Since each gesture is its own macro, I suggest naming them so they'll be huddled together:

    But other than the suggestion to keep them together, the macro names are what matters to you.
  6. Add the macro as a gesture (this is standard SW gesture customization).
    Select Macros as the category and then click the dotted button:
  7. This dialog displays. Navigate to the macro you just saved.
    Optionally: add an icon and a tooltip.
    Five kindergarten-quality icons are in the zip file: Jog Ordinate, ReJog Ordinate, Add to Ordinate, Reference Dim
    The fifth BMP is an empty 16x16, 256 color file (the size & color requirements) as a starting point for your creations.
  8. Click OK and that's it. It's ready.
  9. Gesture as required and click the required entity.
    If a highlighted entity is required before you would usually right-click, then it's required for the gesture click (left click, not right).
  10. For each subsequent context gesture, repeat the above, except you can copy an existing macro and edit only the menu letters.
    For each macro, either from new or by copy, the only thing that will change is the menu letters.


Menu letters:

Context menus, once displayed will respond to the keyboard by pressing its underlined letter (if it has one) or by pressing a letter within its menu text, if not underlined*.

Once a menu's magic letter is pressed, that menu is selected just as if you clicked on it.

So, typing a "D" would select "Display Options". This menu isn't underlined, but the "D" selects it. It's not always the first letter, so select each in succession (for "Edit text" for a note, it's "I"). Case doesn't matter for this.

But for this menu example, there's another "D" menu: "Drawing Views".

When this happens, the menu is highlighted, but not selected. Each press of the "D" (in this example) cycles through all menus with the same menu letter.

When you've selected the menu you want in this situation, you press Enter to select it. (This is all standard Windows menu behavior.)

When you need to press an Enter to operate a context menu selection, type a hyphen "-" in the menu letters of your macro.

So, "d-" picks the first "D" menu and the "j" selects the "Jog" submenu:

That's it.

Determine what your context menu letters are, adding a hyphen when/where an Enter is required.

Add this to the macro with a space separating it from "exe".

The menu letters are passed by command line to the exe, processed and when you left click something, the context menu is run.

So, you must click the appropriate thing which corresponds to the selected gesture.


If you need to bail out before clicking, tap Escape a few times and the gesture is aborted.


There's more menu info at this: [Updated 10/25] Custom context [& pulldown] menus: you build your own menu(s) of favorite/often used menu items (HoverRiteCustomContextMenu V2)

The menu letters needed there are the same as for here.

For this other utility, you build menus, so you need a name plus the menu letters, with these two things separated by the delimiter "|".

For gestures, only the letters after the "|" are required.


The asterisk above means that not all context menus will work for this.

Drawing view menus, for example, don't respond like standard Windows context menus.

You can't navigate them by keyboard (arrow keys and Enter).

So menu items have underlined letter, but not all of those underlined respond to pressing that letter. Some do. Some don't.

The menus without underlined letters don't respond to any of the letters in their menu text.

So, if the desired drawing view menu item works for you, great. But disappointment is most likely. to happen.


I hope you find this utility useful.


Questions and comments are gleefully welcome.




PS: It's called "Gesture-S" because I wanted to also do this for the "S" shortcut menu, but it's not looking like this is possible.

Hopefully, I'm wrong on this and if so, I'll post back with the how-to.


PSS: If you omit the menu letters in the macro, you'll see this dialog:

After OK, nothing happens. Edit your macro and add the required menu letters.