cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
The 2nd thing I wish I knew when I started scripting: Getting help

These are my favorite helps for JSL.These are my favorite helps for JSL.Welcome back!

Apparently, the esoteric content from my first entry in this series didn’t frighten you off. Great! If you’re just tuning in to the series, I’m discussing the five things I wished someone had told me when I started learning to script in JMP. (In all fairness, I was told a lot of this stuff in the JSL course I took from SAS Education and interactions with the instructors after the fact.)

The series is set up for you to follow along with some homework at the end of each episode. So, go back and have a look at the previous entry in the series so you’re not wondering what’s going on or check out the whole series

Getting Help

In my day job, I talk to people about JMP. All day long. I talk to people that have never seen the software before and people who have been using it since before I knew how to use a mouse. It’s a lot of fun, and I learn a lot from all the questions that I answer. One of the things I cover with everyone (because some people refuse to use Google and some just don’t know any better) is where to get help with the software. A lot of programming books I read actually fail to address this incredibly important topic or shove it in the last chapter, almost as an afterthought. My position on this topic, particularly in the context of JSL, is more pragmatic. There is no way we can cover everything in the context of this blog series (or even the next blog series I’m planning, for that matter). There’s just too much to cover. So, before we follow the white rabbit any further down the hole, here are my favorite helps for JSL.

The Scripting Index

Open up JMP and go to Help > Scripting Index. Congratulations! You just accomplished one of the most important tasks for learning JSL. This one tool has got me out of more jams than I care to mention. Every scripter I know has this open during a serious coding session. Every. Single. One. Just get used to having it open.

MikeD_Anderson_0-1594741497536.png

It is the collected knowledge (with examples!) of the JMP developers. It’s updated every release with any changes to JSL or new commands for new platforms in JMP. Why is this so important? Unless you’re scripting all day, every day, there no chance that you will know everything about JSL. This tool fills that gap.

Here's a little example. Open up the Scripting Index, and type "powerpoint" in the filter field. The bottom entry in the second column says "Save Presentation." This gives you the form of the command export a report as a PowerPoint File and an example of how to use it. 

MikeD_Anderson_1-1594741570105.png

 

JMP Tutorials and Sample Data

Now, in JMP go to Help > Sample Data. Note the buttons along the top of the interface. One of them says, “Open the Sample Scripts Directory.”

MikeD_Anderson_2-1594741728217.png

Guess what’s in there? Examples of completed scripts! If you want to know how to get a script to add a formula column to a data table, there’s an example in there. If you want to know how to get JMP to connect to an external dll file, there are a few examples in there. There is nothing wrong with starting from these scripts or using them as templates when you are getting started! That is why they are there.

JMP Documentation

JMP includes a massive amount of documentation, more than 6,500 pages in JMP 15. At ~1,500 pages, the JSL resources make up roughly 20% of that documentation. There are two books in the JSL resources: “The Scripting Guide” and “The JSL Syntax Reference.” This content is also fully searchable on the web, either here The Online Scripting Guide or The Online JSL Syntax Reference. These resources have a lot of useful information and examples about specific use cases. They are good counterpoints to the Scripting Index; the Index is a tactical tool, while the JSL documentation is more of a strategic tool or general reference. The two books provide a lot of material on the different things that JSL can do. In practice, you would look to the Scripting Guide for things like how to work with scripting graphs or how to use Application Builder. You would look to the Syntax reference if you wanted to know all the options for the Bivariate() function or how to use the F Sample Size() function. The Syntax Reference has a lot of overlap with the Scripting Index.  

Reverse Engineering Scripts and Add-Ins

Now, let’s take a break for some trivia:

Did you know that there are multiple copies of da Vinci’s Mona Lisa?

It’s true. Da Vinci ran an art studio with many apprentices who studied his work and attempted to replicate it.  

The Mona Lisa (1503–1516) by Leonardo da VinciThe Mona Lisa (1503–1516) by Leonardo da Vinci  Isleworth Mona Lisa (16th Century) by Workshop of Leonardo da VinciIsleworth Mona Lisa (16th Century) by Workshop of Leonardo da Vinci  Prado Mona Lisa (16th Century) by Workshop of Leonardo da VinciPrado Mona Lisa (16th Century) by Workshop of Leonardo da Vinci  Portrait of a Woman (16th Century) by Raffaello Sanzio (a.k.a. Raphael)Portrait of a Woman (16th Century) by Raffaello Sanzio (a.k.a. Raphael)

Here’s another one:

Did you know that Michelangelo made his money early in his career by copying other artists’ work?

He studied the work of prior masters to improve his skills. He also took commissions to recreate ancient works for people (the Renaissance equivalent of ordering a high-quality touch-up print).

OK, one more:

Do you know what the difference is between an art student and an art forger?

One copies art to learn the techniques while the other tries to pass their work off as being done by the original painter.

Do you see a trend here? I am of the opinion that there is nothing wrong with borrowing from other people’s work with full transparency and proper attribution. Why should you reinvent the wheel? Find someone else’s wheel and see if you can make it better or better fit your needs, as long you give them a mention somewhere. That’s how you learn this stuff!

So, what does that have to do with JMP scripting? Well, there’s a wealth of information put out by people that have studied scripting for years (or actually wrote the code for JSL). It’s all there for you to learn from. But how do you do that? The easy way is to look in the JMP Community in the JSL Scripts section of the File Exchange or the JSL Cookbook. Now, what if you want to have a peek at what people are doing in their add-ins? You can do that, too; it just takes an extra step.

The thing most people don’t know about the JMP add-in transport file (the ones with the .jmpaddin file extension) is that it’s just a zip file with a custom file extension. Unless the author has encrypted their code, there is nothing stopping you from taking a peek under the hood. Just change the “.jmpaddin” to “.zip” and let your operating system (OS) unpack it for you. After the OS has unpacked the zip file, you’ll find a number of files in the folder (the ones you want have the .jsl extension). Tear into them (and pray that the person you’re cribbing from does a good job of commenting their code; more on that later).

You can also have a look at add-ins that you've installed already. You just have to go diving into the file system. The location can be a little hard to find (especially if your IT Admin's have made it hard to go into hidden directories). But, if you can get there, you can find the possible location of your add-in directory here (there are two possible locations each for MacOS and Windows). In that directory, you'll find a bunch of folders (one per add-in) that are named like a backward URL. Inside each folder are the JSL files for a given add-in. Go ahead and have a look!

 

Authors note (15Jul2020):  After publishing this article, @Craige_Hales, the author of the Uncharted Blog and JSL wizard, reminded me in the comments section that you can get to installed add-ins directly from the JMP GUI.  Have a look at the comments below for details!

Paid Resources (Courses and Books)

Strictly speaking, it is possible to learn JSL with just the resources provided in the JMP installation and help on the JMP Community. If all you want to do is string together some bits to make your life a little easier, then that will probably be enough. The thing is, there is a learning curve with JSL. If you want to take your coding beyond what we’re covering in this series, one way or another, you’re going to have to fight up; there are no shortcuts here. You can get some help using the resources I’ve mentioned already, but you’ll still have to put in the time. That said, this is one of the places where I really recommend using some paid resources if you can. If nothing else, you’ll be more committed by putting some skin in the game.

The first one is the Introduction to JMP Scripting Language course offered through SAS Education. I took this course when I started scripting seriously, and I highly recommend it. There is a distinct value in sitting in a classroom and being guided through increasingly more complex exercises. It also gives you someone you can ping if you get stuck on something. (I still talk with my instructor all the time. Hi, Di!) And the course notes are a really helpful resource. There are also two books out there that are really helpful: “Jump into JMP Scripting” and “The JSL Companion.”

Conclusions

That’s the end of this week’s lesson. And it’s the last of the preliminaries. Next week we’re getting into the code. Your homework for this week is to look through the resources I’ve outlined and get to know them. Specifically, start looking at the Scripting Index. Using your problem statement from the last lesson, search through the index for some possible tools or examples that you think might be useful.

Last Modified: Aug 4, 2020 10:49 AM
Comments