list_menu
The list_menu command is to enumerate entries in the menu bars attached to the windows. Its syntax is described in the Communication Protocol.
Arguments
get_windowscommon arguments
Before listing the menu bar, JAuto has to target at least a window first. To achieve this, theget_windowsmechanism was used. Therefore all theget_windowsarguments are supported in this command. Besides these,list_menuhas no other arguments.
Output
The output will be written to a file, following the same format as described Communication Protocol. Below is an example output generated by a list_menu command call:
javax.swing.JFrame,ibgateway.aA,window:0,x:162,y:109,w:700,h:550,act:1,title:IB Gateway
File,x:0,y:0,w:27,h:21,mx:369,my:121,pop:0
File/Gateway Logs,x:0,y:0,w:27,h:21,mx:13,my:10
File/API Logs,x:0,y:0,w:27,h:21,mx:13,my:10
File/Close,x:0,y:0,w:27,h:21,mx:13,my:10
Configure,x:32,y:0,w:63,h:21,mx:419,my:121,pop:0
Configure/Settings,x:32,y:0,w:63,h:21,mx:31,my:10
Configure/Automatic Encryption,x:32,y:0,w:63,h:21,mx:31,my:10,selected:1
Help,x:100,y:0,w:33,h:21,mx:472,my:121,pop:0
Help/About Gateway,x:100,y:0,w:33,h:21,mx:16,my:10
The first line identifies the window. For details about this line, please refer to get_windows output.
Menus and submenus are listed from the second line. Each entry in the menu hierarchy is listed separately. Attributes are comma-delimited, and mostly follow a field_name:field_value format. The following table describes the meaning of each field:
| Unnamed Attribute #1 | “Path” to the menu (see below) |
| x | Screen coordinate x of the menu entry |
| y | Screen coordinate y of the menu entry |
| w | Width of the menu entry |
| h | Height of the menu entry |
| mx | Screen coordinate x of the center point of the menu entry (see notes below) |
| my | Screen coordinate y of the center point of the menu entry |
| pop | Whether a popup menu is currently “popped”, y for yes and n for no. |
Unnamed attribute #1 is the “path” to the menu. It works like file system paths. For the menu entries on the main menu bar, the “path” has only one segment, for instance, File on the second line above. For the submenus under the main entry, the “path” has more than one segment delimited with a slash /, for instance, File/Gateway Logs on the third line above.
In the example output above, the File menu has 3 submenu entries in total. There are 3 main menu entries, namely File, Configure, Help.
Notes regarding mx, my: For the mx, my coordinates to be correct, the menu must be visible. In other words, only the top-level menu entries on the main menu bar have correct mx, my in the beginning. Once you clicked the top-level one and its submenu becomes visible, you have to call list_menu again to get a new set of coordinates to click the entries in the submenu.