Code:
; Defines the response hot string
: Menu ::
Define the first sub-menu item of the menu to be displayed
Menu, amenu, add, txt
Menu, amenu, add, Doc
Menu, amenu, add, QQ
Menu, amenu, add, FAP
; Defines the second sub-menu item of the menu to be displayed
Menu, bmenu, add, disable Computer, shut
Menu, bmenu, add, control panel, conpal
Define menu items to be displayed
Menu, mymenu, add
Menu, mymenu, add, working directory to jump, me
Menu, mymenu, add, common program,: amenu
Menu, mymenu, add, common operations,: bmenu
Menu, mymenu, add
Menu, mymenu, color, c0c0c0
Menu, mymenu, show, 300,200
Menu, mymenu, deleteall
Return
Define the response code for each menu item
TXT:
Run, notepad
Return
DOC:
Run, winword
Return
QQ:
Run, D:/Tencent/QQ/qq.exe
Return
FAP:
Run, D:/FAP/fairy_ape.exe
Return
Shut:
Shutdown, 8
Return
Conpal:
Run, control
Return
Me:
Run, F:/me
Return
Description 1:
The order of writing the menu code is as follows:
1. Define sub-menu items first; 2. Write menu items; 3. Write the code to display the menu; 4. Write the deletion code; 5. Write the response code.
NOTE 2:
The menu command is the command that Ahk uses to create, delete, modify, and display menus (I think more menu should be right-click). It can also be used to modify the icons and prompts displayed on the system tray.
The basic format is too messy to be written in the Help File of Ahk. Let me briefly describe it.
Format 1: menu, menuname, add; the code is used to display a split line in the menu;
Format 2: menu, menuname, add, menu item, response flag
For example: menu, mymenu, add, working directory to jump, me
Mymenu is a menu variable defined by you, and "Jump working directory" is the content displayed in the menu item in the future. Me is the response flag.
Me:; Note the colon here
Response code ......
Return
In the form.
Sometimes, you will see code like menu, amenu, add, and TXT. In fact, this code is
A short form of menu, amenu, add, txt, and TXT. It is abbreviated because the menu item and response flag have the same name.
Format 3: menu, add, sub-menu item, sub-menu variable
Code is used to display a sub-menu item in the menu, such as: menu, mymenu, add, common program,: amenu
Here, amenu is the amenu in the menu, amenu, add, and TXT defined at the beginning of the Code.
NOTE 3:
Menu, menuname, show, X coordinate, Y coordinate
Displays menu items at the specified coordinates. If coordinates are omitted, the menu items are displayed at the current mouse position.
Note: You may define a lot of menu variables when defining them. The menu variables will be used in menuname when you finally need to display them.
Note 4:
Menu, menuname, color, color code
Used to specify the background color of the display menu
Note 5:
Menu, mymenu, deleteall
It is used to delete all menus. I don't know why. Without this code, if your code has a split line, you will find that your menu is displayed once more and the split line will double.
You can also choose not to use the split line, so you can skip this line of code, but it is better to add a split line in your menu.
Note 6:
Shutdown is a command used to restart, shut down, and log out of the system.
Logoff 0 shutdown 1 reboot 2 force 4 power down 8
The code here can also be added.