Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
MenuItem.SetScriptAction
Sets which script is called if a menu item in this menu is selected.
Component |
Version |
macOS |
Windows |
Linux |
Server |
iOS SDK |
Menu
|
4.1 |
✅ Yes |
✅ Yes |
❌ No |
❌ No |
❌ No |
MBS( "MenuItem.SetScriptAction"; item; FileName; ScriptName { ; ScriptParameter } )
More
MBS(
"MenuItem.SetScriptAction"; /* Sets which script is called if a menu item in this menu is selected. */
$item; /* The reference to the menu item. Please create one with
MenuItem.CreateMenuItem or
MenuItem.CreateSeparator. */
$FileName; /* The filename of file which contains the script.e.g. "Menus.fmp12" */
$ScriptName; /* The name of the script.e.g. "MenuScript" */
$ScriptParameter) /* Optional; If you want a specific script parameter.
Default is to leave empty and get the ID fo the menu item.
You can store a value with the menu item via
MenuItem.SetTag. */
Less
Parameters
Parameter |
Description |
Example |
Flags |
item |
The reference to the menu item. Please create one with MenuItem.CreateMenuItem or MenuItem.CreateSeparator. |
$item |
|
FileName |
The filename of file which contains the script. |
"Menus.fmp12" |
|
ScriptName |
The name of the script. |
"MenuScript" |
|
ScriptParameter |
If you want a specific script parameter.
Default is to leave empty and get the ID fo the menu item.
You can store a value with the menu item via MenuItem.SetTag. |
|
Optional |
Result
Returns OK or error.
Description
Sets which script is called if a menu item in this menu is selected.
You can use MenuItem.SetScriptAction to associate a script with individual items or use this function for a whole menu.
See also MenuItem.GetScriptFileName and MenuItem.GetScriptName.
With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.
Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.
Examples
Add menu item with script to be called:
Set Variable [$item; Value:MBS("MenuItem.CreateMenuItem"; "Hello World")]
Set Variable [$r; Value:MBS("MenuItem.SetScriptAction"; $item; Get(FileName); "MenuScript")]
Set Variable [$r; Value:MBS("Menu.AddItem"; $menu; $item)]
See also
Example Databases
Blog Entries
This function checks for a license.
Created 18th August 2014, last changed 2nd December 2016
MenuItem.SetRequireShift
-
MenuItem.SetSelectable