Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Menubar.RunMenuCommand
Runs a menu command.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Menubar | 5.0 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Path | The ID or path to the menu entry. Use Menubar.ListMenuCommands to find out the IDs and names. |
49297 | |
Delay | for macOS an optional delay to run the command after seconds. e.g. pass 0.1 to run command after 100ms. |
Optional |
Result
Returns OK or error.
Description
Runs a menu command.The plugin searches menu command and invokes it.
For Windows, the command is run asynchronously, so the function returns before the command runs. You may need to make a script pause to run the command.
For a couple of menu commands you may need to use Schedule.EvaluateAfterDelay to make sure the plugin invokes the menu after the script finished running.
Examples
Run command to select all:
MBS("Menubar.RunMenuCommand"; "Bearbeiten¶Alles auswählen")
Show debugger:
MBS("Menubar.RunMenuCommand"; "Werkzeuge¶Script-Debugger")
Show debugger from within a script:
#The menu command as we got it from Menubar.ListMenuCommands
Set Variable [$DebuggerMenuID; Value:49260]
If [MBS( "Menubar.HasMenuCommand"; $DebuggerMenuID ) = 1]
If [MBS( "Menubar.IsMenuCommandChecked"; $DebuggerMenuID ) = 1]
#debugger already visible
Else
#show debugger
Set Variable [$r; Value:MBS( "Menubar.RunMenuCommand"; $DebuggerMenuID )]
Pause/Resume Script [Duration (seconds): ,1]
End If
Else
Show Custom Dialog ["Debugger missing in Menubar?"]
End If
#now follows your script that should always run in debugger
Show/Hide format bar in German:
Set Variable [ $r ; Value: MBS( "Schedule.EvaluateAfterDelay"; ,1; "MBS( \"Menubar.RunMenuCommand\"; Liste(\"Ansicht\"; \"Formatierungsleiste\") )") ]
Make snapshot link with F5 hotkey:
Set Variable [ $$Hotkey ; Value: MBS("HotKey.Register"; "F5"; "") ]
Set Variable [ $r ; Value: MBS( "HotKey.SetEvaluate"; $$Hotkey; "MBS( \"Menubar.RunMenuCommand\"; 50285 )" ) ]
Enter layout mode in a second:
Set Variable [ $r ; Value: MBS ( "Schedule.EvaluateAfterDelay" ; 1 ; "MBS ( \"Menubar.RunMenuCommand\" ; 49156 )" ) ]
Toggle formatting bar:
Set Variable [ $r ; Value: MBS( "Menubar.RunMenuCommand"; "50204"; 1 ) ]
See also
- HotKey.Register
- HotKey.SetEvaluate
- Menubar.HasMenuCommand
- Menubar.IsMenuCommandChecked
- Menubar.ListMenuCommands
- PageSetupDialog.Enable
- PageSetupDialog.Install
- Schedule.EvaluateAfterDelay
- SyntaxColoring.AddContextMenuCommand
- TouchBar.AddButton
Example Databases
- Mac only/Print/Page Setup Dialog on Mac
- Mac only/Print/Page Setup Dialog
- Mac only/TouchBar
- SQL in FileMaker/Custom Functions to Log Scriptcalls
- Win Only/Search Scripts
- Win Only/Snippets for Windows
Blog Entries
- Goodies 33: Custom context menu commands for FileMaker ScriptWorkspace
- Adding ChatGPT to the ScriptWorkspace context menu
- Data Viewer extensions
- New functions of the MBS Plugin Version 9.5
- Define hot keys for functions in the FileMaker development
- Add a search and replace command for FileMaker Script Workspace
- Custom context menu commands for FileMaker ScriptWorkspace
- Page Setup Dialog example
- Tip of the day: Show debugger in FileMaker from within a script
- MBS FileMaker Plugin 5.0 for OS X/Windows - More than 3000 Functions In One Plugin
FileMaker Magazin
This function checks for a license.
Created 15th November 2014, last changed 28th June 2024