HRWL

Autoit Popup Menu

5 posts in this topic

Been searching and cant find a function or method to duplicate this Autohotkey function https://autohotkey.com/docs/commands/Menu.htm
Anyone have a way on how to?

Am trying to recreate a popup custom context menu via hotkey for shortcuts to apps, scripts, etc.

Share this post


Link to post
Share on other sites



If you have been searching as you say, I am surprised you missed these in the help file:

  • TrayCreateMenu
    • TrayCreateItem
  • GuiCtrlCreateMenu
    • GuiCtrlCreateMenuItem

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

For a context menu:

$ContextMenu = GUICtrlCreateContextMenu($SomeControl)
Local $Menu = GUICtrlCreateMenu("Functions", $ContextMenu, 1)
GUICtrlCreateMenuItem("Blahblah", $Menu, 1)
GUICtrlSetOnEvent(-1, "Jump2ThisFunctionName")
GUICtrlCreateMenuItem("Blahblah2", $Menu, 2)
GUICtrlSetOnEvent(-1, "Jump2ThisFunctionName2")

 


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites
On 9/7/2017 at 1:59 PM, JLogan3o13 said:

If you have been searching as you say, I am surprised you missed these in the help file:

  • TrayCreateMenu
    • TrayCreateItem
  • GuiCtrlCreateMenu
    • GuiCtrlCreateMenuItem

I did in fact miss the TrayCreateItem... But what I'm looking for with this is similar to GuiCtrlCreateMenuItem, but without having to create a gui beforehand.

With my current script running on AHK, following example #2, the context menu waits for a hotkey, when activated, the menu shows up reguardless of active windows, I select the item and the script runs it's set action, and hides until activated again.

 

Quote

; EXAMPLE #2: This is a working script that creates a popup menu that is displayed when the user presses the Win-Z hotkey.

; Create the popup menu by adding some items to it.
Menu, MyMenu, Add, Item1, MenuHandler
Menu, MyMenu, Add, Item2, MenuHandler
Menu, MyMenu, Add  ; Add a separator line.

; Create another menu destined to become a submenu of the above menu.
Menu, Submenu1, Add, Item1, MenuHandler
Menu, Submenu1, Add, Item2, MenuHandler

; Create a submenu in the first menu (a right-arrow indicator). When the user selects it, the second menu is displayed.
Menu, MyMenu, Add, My Submenu, :Submenu1

Menu, MyMenu, Add  ; Add a separator line below the submenu.
Menu, MyMenu, Add, Item3, MenuHandler  ; Add another menu item beneath the submenu.
return  ; End of script's auto-execute section.

MenuHandler:
MsgBox You selected %A_ThisMenuItem% from the menu %A_ThisMenu%.
return

#z::Menu, MyMenu, Show  ; i.e. press the Win-Z hotkey to show the menu.

 

Untitled.png

Share this post


Link to post
Share on other sites

So a context menu of sorts, activated by a hotkey, that can appear on top of any window? I'd say you can create a bogus window and spawn a menu like that, im not sure, but i think you really have to create a window, even if it's transparent.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now