Subscribe Bookmark
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

How to create an add-in for JMP

JMP 9 introduced an add-in architecture that makes creating and distributing extensions to JMP easy. This makes JMP a platform for creating new analytic tools. It also makes it easy to add new functionality. Creating a JMP add-in is pretty simple. All you need to know is JMP Scripting Language (JSL).

There are two distinct phases to the process of creating a JMP add-in: development and deployment.

We'll cover development first.

Begin the process of developing your add-in by creating a folder to contain all the pieces that your add-in might require. This is your "add-in folder".

Next, you'll need to decide on some names.

Each JSL add-in must have a unique ID. This is a name that is rarely seen by the end user of an add-in. We suggest that you use something like the reverse DNS naming convention to create this unique name.

For this example, I'll call my add-in "com.jmp.jperk.texttocols".

An add-in also has a display name, which is what the user will see most of the time. This is a friendlier name, and there is no requirement for uniqueness with this name. I'll call mine "Text to Columns".

In your add-in folder, create a text file called "addin.def".

The contents of this file should be as follows, substituting your unique ID and display name as appropriate:

id="com.jmp.jperk.texttocols"

name="Text to Columns"

Now, you need to register your add-in with JMP. Do this by opening the addin.def file with JMP. When you do this, JMP will prompt you to ask if you want to install your add-in.

This seems odd at first, but you'll need this so JMP knows about your add-in as you develop it. Go ahead and click "Install" to complete the registration.

This registration connects the ID for your add-in with your add-in directory. You can now reference this directory using the $ADDIN_HOME(uniqueID) path variable. For example, you could use the include function like this:

include("$ADDIN_HOME(com.jmp.jperk.texttocols)/texttocols.jsl");

Now begin writing the JSL for your add in. Save it into your add-in directory.

As you write your JSL, if you need to refer to any external files, like data or a DLL, put them in your add-in directory. You should use the $ADDIN_HOME(uniqueID) path variable to reference them in your JSL code.

After your JSL is complete, you'll need to build a custom menu, so users of your add-in can access it.

Go to View->Customize->Menus and Toolbars to launch the menu editor.

Click the "Change..." button at the top of the editor to change to editing customizations for your add-in.

Now, you can create a custom menu item to launch your JSL. I'm putting mine in the Columns menu after a separator.

Give your menu command a unique, Internal Name. This is the name that JMP will use to find this menu item if it's referred to by other custom menus. Next, put the text of the menu item itself in the Caption field. This is what will be shown in the menu. You can also insert a tooltip in the Tip field. Use the Localize buttons to put localized versions of the Caption and Tip, if you desire.

In the "Action" section, choose "Run JSL in this file" and then click the the checkbox next to "Use add-in home folder" and make sure that your add-in ID is chosen.

Note the "Icon" section where you could use an image file from your add-in home folder as the icon for your menu item.

When you click "OK", JMP will save the customization file you just created in your add-in directory as "addin.jmpcust".

You're now ready to package your add-in for deployment. You need to create a .ZIP archive of: 1) addin.def, 2) addin.jmpcust, 3) your .JSL file and any other dependencies.

You'll need to change the ".zip" extension on the archive to ".jmpaddin".

Now you can test your packaged add-in.

Start by Unregistering the development version of your add-in. (View->add-ins)

Now, double-click on the .jmpaddin file that is now your deployable add-in.

JMP will ask you if you'd like to install your add-in.

After you install it, you'll see it listed in the View->Add-ins... dialog. Note that the directory is not your add-in directory but a directory in the user area for JMP.

JMP has expanded the .zip archive into this user area. Click on the directory name in the dialog to see its contents. This is convenient for looking at any JSL used by an add-in.

Finally, you can go to the custom menu created by the add-in to launch it.

3 Comments
Community Member

Jens Riege wrote:

Thanks Jeff for creating these instructions. They look very useful and I plan on creating some internal script menus for use within our group!

Community Member

Brandon Breitling wrote:

Hi Jeff,

I was wondering, I'm trying to modify your six sigma add-in on my computer but when I try to it tells me that it was not made with jmp add-in builder so it might not be able to. I did it anyway and can't see any of the JSLs or anything. Is there a way for me to look at the code for it and modify it?

Community Manager

Jeff Perkinson wrote:

Hi Brandon,

Since the Six Sigma Add-in was created in an earlier version of JMP it doesn't use the Add-in builder.

Most of what that add-in does is call platforms in JMP via custom menu items, so there's very little actual JSL.

You can see exactly what it's doing and modify it using the View->Customize->Menus and Toolbars option. Once in the menu editor you'll need to change the customization set â using the "Change..." button at the top â to edit the menus for the add-in.

I hope that helps.

-Jeff