To create a JMP add-in, you write the scripts and gather files that are used in the add-in. Then you compile the scripts into an add-in.
• On Windows, select File > New > Add-In.
• On macOS, select File > New > New Add-In.
• In Dashboard Builder, click the red triangle and select Save Script > To Add-In.
The process of compiling scripts into an add-in involves the following steps:
• Create Toolbars (Windows Only)
• Specify Start-up and Exit Scripts (Optional)
First, in the General Info tab, add the general information that identifies and sets up your add-in.
Figure 17.28 Add-In Builder General Info Tab
1. Enter a name for the add-in.
This is the name of the registered add-in, which appears in the View > Add-Ins window.
2. Enter a unique identifier string.
Unique ID strings are case-insensitive. To ensure uniqueness, it is strongly recommended to use reverse-DNS names (for example, com.mycompany.myaddin). The ID string must meet the following requirements:
– It can be up to 64 characters in length.
– It must begin with a letter.
– It should consist only of letters, numbers, periods, and underscores.
– It should contain no spaces.
In JSL, use this string to refer to the add-in (for example, in calls to Get Addin() or as an argument to $ADDIN_HOME).
3. Enter the version of the add-in.
If you decide to make changes to the add-in at a later date, you can update the version number and then verify that users have the correct version.
4. Select the minimum version of JMP that the add-in works on.
Note: Add-ins were introduced in JMP 9, so no prior versions are supported. And when saving an application as an add-in, select 10 or 11 as the JMP minimum version.
5. Select whether you want the add-in to be supported on Windows, macOS, or both.
6. (Optional) Select the check box next to Install after save if you want to install the add-in after saving it.
If you do not select this option, the add-in is not installed once you save it, and it does not appear as a selectable menu item in the Add-Ins menu.
1. Click the Menu Items tab.
Figure 17.29 Add-In Builder Menu Items Tab
2. (Optional) Click Add Submenu.
If you have multiple add-ins, you can group them under a submenu.
3. If you add a submenu, next to Menu item name, enter the name of the submenu.
This name appears in the Add-Ins menu.
4. Click Add Command.
5. Next to Menu item name, enter the name of the add-in command.
6. (Optional) Next to Tooltip for menu item, enter the content that appears as a tooltip when the users place their cursor over the menu item.
7. Add the script. Select either Run this JSL and copy and paste in your script, or select Run JSL in this file and click Browse to find the file containing your script.
8. (Optional) Select Use the “Here” namespace for unqualified JSL variable names to ensure that all unqualified JSL variables are in the Here namespace, and local only to the script.
Notes:
– If your script creates a custom menu or toolbar, the variables are in the Here namespace by default.
– For more information about the Here namespace, see Advanced Scoping and Namespaces.
9. (Optional) Browse to add an icon that appears next to the menu item in the Add-Ins menu.
10. (Optional, Windows only) Create a keyboard shortcut for the add-in.
11. To add multiple menu items, repeat the steps.
You can add multiple levels of submenus and add-in commands.
12. Click Save and save the add-in to the desired directory.
13. Click Close.
1. Click the Toolbar tab.
Figure 17.30 Add-In Builder Toolbar Tab
2. Click Add Command.
3. Next to Caption, type the name of the toolbar item. This name is only for internal use. The user does not see it.
4. Add the script. Select either Run this JSL and copy and paste in your script, or select Run JSL in this file and click Browse to find the file containing your script.
5. (Optional) Select Use the “Here” namespace for unqualified JSL variable names to ensure that all unqualified JSL variables are in the Here namespace, and local only to the script.
6. Click Save and save the add-in to the desired directory.
7. Click Close.
Note: For more information about customizing menus in JMP, see Customize Menus and Toolbars in Using JMP.
Click the Start-Up Script tab to add a script that runs when JMP starts up (and the add-in starts). You can select an existing script (Run JSL in this file) or copy and paste in a script (Run this JSL). For example, you could provide a message telling the user that the add-in is installed upon start-up.
Click the Exit Script tab to add a script that runs when JMP exits or when you disable the add-in. You can select an existing script (Run JSL in this file) or copy and paste in a script (Run this JSL). For example, you could provide a prompt for the user to export a JMP data table upon exiting or disabling the add-in.
If your script calls other scripts, or contains graphics or data tables, add those files here.
Save the add-in by clicking the Save button on any tab. This effectively creates the add-in.
• If you selected the Install after save option in the General Info tab, then the add-in menu item appears in the Add-Ins menu immediately.
• If you did not select the Install after save option, when you open the saved add-in file, you are prompted to install the add-in.
Once your add-in is installed, test your add-in:
1. Select View > Add-Ins.
2. Select your add-in and click Unregister.
3. Reinstall your add-in by either selecting File > Open in JMP, or by double-clicking your .jmpaddin file.
4. Ensure that the menu and toolbar button run your script correctly and that the script itself runs correctly.