These commands allow introspection and activation of menus. Superseded by the Menu object.
Menu path
Activates the menu with the specified path, just as if a user had chosen the menu. The path can be an absolute path (“:Format:Bold”), a path suffix (“Text Color:Red”), or simply a title (“Heading 1”). If the path is ambiguous (eg: “Red”) then which menu is activated is undefined.
Menu Exists path v1.0.1
Returns @true if a menu with the provided path exists, otherwise @false.
Menu Enabled path v1.0.1
Returns @true if a menu with the provided path exists and is enabled, otherwise @false.
Menu State path v1.0.1
Returns an integer that describes what state the menu shows beside it:
Menu Shows |
Returns |
State |
|
1 |
The menu is checked. |
|
-1 |
The menu state is mixed. |
|
0 |
Neither checked nor mixed. |
If the menu does not exist, returns zero.
Note: for performance reasons the menu state may not be exactly calculated. If a large amount of text is selected, or there are many noncontiguous selections, only some subset of the selected text may be inspected.
Set Menu State menuPath, checkmarked v2.1.5
Ensures the menu with the provided path is checkmarked (has a menu state of 1) or is completely unchecked (has a menu state of 0). If the menu’s current state doesn’t match the requested state, then the menu will be activated once. This can be used to ensure some options or formatting is in effect, for example:
Set Menu State ":Format:Font Face:Bold", @true # ensures text is bold
Set Menu State ":View:Comments", @true # ensures comments visible
Set Menu State ":View:Tracked Changes", @false # ensures changes hidden
Note: if the given menu never shows any state, for example the menu File > New, then this command will simply activate the menu once.
Contextual Menu path v1.0.1
Activates a menu in the pop-up/contextual menu (eg: when a user right-clicks on text).
Contextual Menu Exists path v1.0.1
Returns @true if the specified contextual menu exists, otherwise @false.
Menu Shortcuts v1.3
Returns an array of all keyboard shortcuts that have been assigned. At every even numbered index in the array (0, 2, 4...) is a shortcut, while the following odd index (1, 3, 5...) contains the path of the menu the shortcut is assigned to. An example array:
(“⌘V”, “:Edit:Paste:Paste”,
“⇧⌘V”, “:Edit:Paste:Paste Text Only”)
The returned array is sorted by shortcut and always contains an even number of objects (eg: each shortcut always has a corresponding menu). The returned array may contain paths to menus that do not exist in the current document (eg: consider a style that is not included in every document).
Previous Chapter Superseded Commands |
<< index >> |
Next Chapter Selection |