Arrange menu Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Arrange menu

02 Jan 2022, 20:51

@flyingDman thanks so much!! Exactly what I needed.

I have just 1 final question

Would it be possible to get a "favorite" part of the menu to always appear next to the cursor, while the rest is being opened normally with the bar breaks on the side?

Even if it's a trick, anything could help
User avatar
flyingDman
Posts: 2848
Joined: 29 Sep 2013, 19:01

Re: Arrange menu

02 Jan 2022, 23:00

I am not sure I understand your question. You have full control over the location of each menu item but you cannot move columns around dynamically, so that if you have a menu with many columns and open it while your mouse pointer is on the right edge of the monitor, your first column will not be close to the mouse pointer. I am not aware of a way to dynamically change that.
14.3 & 1.3.7
User avatar
boiler
Posts: 17393
Joined: 21 Dec 2014, 02:44

Re: Arrange menu

02 Jan 2022, 23:08

If you just want a certain menu item to be under the cursor when the menu opens, just subtract the distance in pixels it is in the x and y directions from the upper-left corner of the menu from the variables x and y.
sree2022
Posts: 3
Joined: 28 Aug 2022, 11:51

Re: Arrange menu

28 Aug 2022, 11:55

Hi I am a newbie. I can see the menu but can you give example how to get each button work ?
User avatar
flyingDman
Posts: 2848
Joined: 29 Sep 2013, 19:01

Re: Arrange menu

28 Aug 2022, 12:31

The "execute" label in my example above was left blank but that's where you would would put any action on the press on any of the buttons. One of the ways to handle a large amount of menu buttons is to use the switch .... case construction (see here: https://www.autohotkey.com/docs/commands/Switch.htm). Like so:

Code: Select all

loop, 9
	Menu, scripts, Add, test%a_index%, Execute, % !mod(a_index - 1,3) ? "+barbreak" : ""
Menu, scripts, Show
return

execute:
switch A_ThisMenuItem
	{
	case "test1" : msgbox, You clicked test1
	case "test2" : msgbox, You clicked test2
	case "test3" : msgbox, You clicked test3
	case "test4" : msgbox, You clicked test4
	case "test5" : msgbox, You clicked test5
	case "test6" : msgbox, You clicked test6
	case "test7" : msgbox, You clicked test7
	case "test8" : msgbox, You clicked test8
	case "test9" : msgbox, You clicked test9
	}
return
Which is quite a bit shorter than this:
Spoiler
14.3 & 1.3.7

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, Descolada, Google [Bot], GroggyOtter, moltenchees and 164 guests