Toolbar.Register
----------------

Registers a new toolbar button.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Toolbar](component_Toolbar.md) [Window](component_Window.md) | [4.3](newinversion43.md) | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |

MBS( "Toolbar.Register"; Identifier; FileName; ScriptName; Parameter; Label; PaletteLabel; Tooltip; Image ) 

**MBS**( **"Toolbar.Register";** /\* Registers a new toolbar button. \*/  
**$Identifier**; /\* The toolbar identifier. Must be an unique string.e.g. "Test" \*/   
**$FileName**; /\* The file name of the FileMaker database where the script is located.e.g. "Toolbar.fmp12" \*/   
**$ScriptName**; /\* The name of the script to call when toolbar item is pressed.e.g. "ToolbarScript" \*/   
**$Parameter**; /\* The parameter to pass to the script. This can be same as identifier. Using different parameters allows you to use one script for all toolbar items.e.g. "SwitchToMainLayout" \*/   
**$Label**; /\* The label, which normally appears in the toolbar and in the overflow menu.e.g. "Hello" \*/   
**$PaletteLabel**; /\* The label that appears when it is in the customization palette. Can be same as label or different.e.g. "Hello World" \*/   
**$Tooltip**; /\* The tooltip for the label!e.g. "click me" \*/   
**$Image**) /\* The image to use for the toolbar item. Pass a container value with JPEG, TIFF, PNG or other image formats. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Identifier | The toolbar identifier. Must be an unique string. | "Test" |
| FileName | The file name of the FileMaker database where the script is located. | "Toolbar.fmp12" |
| ScriptName | The name of the script to call when toolbar item is pressed. | "ToolbarScript" |
| Parameter | The parameter to pass to the script. This can be same as identifier. Using different parameters allows you to use one script for all toolbar items. | "SwitchToMainLayout" |
| Label | The label, which normally appears in the toolbar and in the overflow menu. | "Hello" |
| PaletteLabel | The label that appears when it is in the customization palette. Can be same as label or different. | "Hello World" |
| Tooltip | The tooltip for the label! | "click me" |
| Image | The image to use for the toolbar item. Pass a container value with JPEG, TIFF, PNG or other image formats. | $image |

### Result

Returns OK or error.

### Description

Registers a new toolbar button.  
Please use an identifier with your own prefix/suffix to make sure you have no conflict with existing identifiers.   
Once your item is registered, the next time the toolbar updates itself it will use it.   
You can use [Window.SetToolbarConfiguration](WindowSetToolbarConfiguration.md) or the customize palette to add your toolbar item.  
  
You need to call [Toolbar.Install](ToolbarInstall.md) at least once before using this command to have it take effect.  
  
  
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

Register custom button:

 Set Variable \[$r ; MBS ( "[Toolbar.Install](ToolbarInstall.md)" ) \]  
Set Variable \[$r ; MBS ( "Toolbar.Register"; "TestItem"; Get(FileName); "ToolbarScript"; ""; "MBS Button"; "MBS Button"; "Just a test button"; Toolbar::Image ) \]  
### See also

- [Toolbar.Install](ToolbarInstall.md)
- [Toolbar.Unregister](ToolbarUnregister.md)
- [Window.SetToolbarConfiguration](WindowSetToolbarConfiguration.md)

### Example Databases

- [Mac only/Toolbar/Custom Toolbar Items](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/Toolbar/Custom%20Toolbar%20Items.shtml#1GroupButton96.0000000402.0000000122.0000000553.0000000LayoutObjectAnchor_)

### Blog Entries

- [Replace toolbar images and labels](https://www.mbsplugins.de/archive/2016-09-12/Replace_toolbar_images_and_lab/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 4.3 for OS X/Windows - More than 2700 Functions In One Plugin](https://www.mbsplugins.de/archive/2014-09-16/MBS_FileMaker_Plugin_43_for_OS/monkeybreadsoftware_blog_filemaker)
- [Toolbar functions for FileMaker on Mac](https://www.mbsplugins.de/archive/2014-08-27/Toolbar_functions_for_FileMake/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 20th August 2014 , last changed 20th November 2021

  
[Toolbar.InstallBackground](ToolbarInstallBackground.md) - [Toolbar.SetImage](ToolbarSetImage.md)

[HTML Version](ToolbarRegister.shtml)