Adding items to context menu

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
HMPrintDesign
Posts: 8
Joined: 07 Dec 2017, 07:23

Adding items to context menu

Post by HMPrintDesign » 08 Dec 2021, 07:35

Hello
I've spent a few hours looking but I'm getting lost.

What I am trying to do is just add non-clickable (label only) to the context menu. I want to list some of my AHK shortcodes here because I keep forgetting what the keyboard command are.. :roll: LOL

Everything I found seemed far too complicated for what I need.



I appreciate you!,
Stephen and Wayne Hesler-Mondore
HM Design
hmprintdesign.com

RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: Adding items to context menu

Post by RussF » 08 Dec 2021, 08:32

If you have just one script that you run that has all your hotkeys and hotstrings in it, you could just add another one on an unused hotkey such as Ctrl-Alt-h for "help" that just displays a tooltip wherever your cursor is.

Russ

User avatar
HMPrintDesign
Posts: 8
Joined: 07 Dec 2017, 07:23

Re: Adding items to context menu

Post by HMPrintDesign » 08 Dec 2021, 09:06

Thankyou for that,

but I'm looking for is just a menu to list keys. SO what I really want is, when I right click this list is added to the context menu no matter where I am on the monitor.

{RIGHT CLICK}
Windows standard context menu appears
____________________________
My custom menu [no links needed, just test]
Screenshot 2021-12-08 090357.png
Screenshot 2021-12-08 090357.png (13.53 KiB) Viewed 2376 times
see attached image. I want everything from Explorer down to just be a text list as shown.



I appreciate you!,
Stephen and Wayne Hesler-Mondore
HM Design
hmprintdesign.com

User avatar
mikeyww
Posts: 26869
Joined: 09 Sep 2014, 18:38

Re: Adding items to context menu

Post by mikeyww » 08 Dec 2021, 09:33

RussF idea makes sense because programs can have their own context menus.

RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: Adding items to context menu

Post by RussF » 08 Dec 2021, 09:40

If you have a mouse with a left-right wheel (which most people either don't know about or don't use) you could attach the tooltip like so...

Code: Select all

MyKeyList =
(
F-Explorer
C-Calc
X-Fax
WCNY
...
)
IsToolTip := False

WheelRight::
    IsToolTip := !IsToolTip
    If (IsToolTip) {
        ToolTip, %MyKeyList%
    } Else {
        ToolTip
    }
Return
You could, of cours, use WheelLeft or if you don't use your wheel button, MButton.

It is a toggle, so activate it to display the tooltip, then again to remove it.

Russ

User avatar
HMPrintDesign
Posts: 8
Joined: 07 Dec 2017, 07:23

Re: Adding items to context menu

Post by HMPrintDesign » 08 Dec 2021, 12:13

Awesome.. but it doesn't work.

I modified as such to use a CTRL shirt left mouse click

Code: Select all

;Add Context Menu
MyKeyList =
(
F-Explorer
C-Calc
X-Fax
WCNY
)
IsToolTip := False

^+LButton::
    IsToolTip := !IsToolTip
    If (IsToolTip) {
        ToolTip, %MyKeyList%
    } Else {
        ToolTip
    }
Return
[Mod edit: [code][/code] tags added.]

Nothing happens

RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: Adding items to context menu

Post by RussF » 08 Dec 2021, 13:46

I copied your code exactly and it worked perfectly. Did you try the script all by itself, with no other scripts running?

If you are adding it to an existing script, you need to place the top half (everything before the "^+LButton" line at the very top of the script where it will get executed before any hotkey definitions. The rest can go anywhere.

Russ

User avatar
HMPrintDesign
Posts: 8
Joined: 07 Dec 2017, 07:23

Re: Adding items to context menu

Post by HMPrintDesign » 08 Dec 2021, 14:24

THANK YOU THANK YOU

That worked moving that snippet to the top.

Post Reply

Return to “Ask for Help (v1)”