Writing and Sharing AppleScripts for Nuimo

Nuimo was built on an open platform, meaning that you can create custom AppleScripts and integrations as you like. This article outlines a few simple steps to write and share your own AppleScripts for OS X programs.

In the case of OS X, you can program many custom AppleScripts and easily make them available to the greater Nuimo community. At the moment, the Senic team is working to include hundreds of custom AppleScripts for dozens of OS X programs – but to get there we need your help!

Getting started with creating custom AppleScripts for Nuimo is simple — below are a few simple steps to write and share your own AppleScripts.

How To Write Custom Actions

Custom actions are provided in the form of AppleScripts. An AppleScript is a tiny code snippets that allows for automation of commands in your favorite OS X applications, e.g. actions such as “Increase Brush Size” in Photoshop or “Play Next Track” in iTunes. To write your own actions, simply follow these quick steps:

1. Download and open the Nuimo for OS X app and connect your Nuimo.

2. Add the OS X application that you want to control with Nuimo.

3. Now select the input gesture that you want to write an AppleScript for, choose AppleScript from the drop down list and click the Edit… button.

4. You will see an AppleScript window appear. In this window you can now type your custom AppleScript (we are writing an AppleScript to open a new tab in Google Chrome in our example):

5. Once you save, your custom AppleScript will be executed every time when the selected application is in foreground.

6. You can now go into your application and trigger the AppleScript you’ve created. In our example when we open Google Chrome and press Nuimo’s button, our custom AppleScript will be triggered and it opens a new tab.

What Does AppleScript Look Like?

AppleScripts are written in a language that is similar to regular English. Because of this, it’s actually fast for anyone to write AppleScript, even with a low level of coding knowledge.

Examples of valid AppleScripts could be:

The first line reads a text for you. The second line executes the keyboard shortcut ⌘+N. And the third line opens a new tab in your Google Chrome browser. An AppleScript can contain a single line or, like a macro, execute a sequence of commands.

How Do I Know If My Application Supports AppleScript?

Essentially all applications can be controlled using AppleScripts. Technically it is as simple as sending a keyboard shortcut to your application. Some applications however, have extended AppleScripts support — to learn more about specific programs you can do a simple internet search. For example, searching “Google Chrome AppleScript” reveals a number of resources about how to automate that browser.

Where Can I Learn More About AppleScript?

Here are a few of our favorite resources for learning more about AppleScript:

How to Share Custom Actions

Once you have created and saved an AppleScript action to your computer, you can submit it for review to be included in the Nuimo OS X app. These scripts can then be accessed and used by thousands of people in the Nuimo community!

How Do I Name My AppleScript Action So It Can Be Shared?

In order for your AppleScript to be added to the Nuimo OS X app, it must be named properly. To understand how to do this you must take note of how the AppleScript provided by the Nuimo community are structured in the Nuimo app.

Community scripts for Nuimo are stored in your user folder /Users/<Username>/Library/Application Support/Nuimo/Application Actions. Each time you restart the Nuimo app this folder gets synchronized with all available actions that the Nuimo community has created and shared. This is where your submitted shortcuts end up after they are approved by Team Senic. The community repository for all available actions is hosted publicly at GitHub — more details about this below.  

Inside this repository is a list of folders named after the applications. Inside each folder is a list of available AppleScript actions that have been shared either by Team Senic or the Nuimo Developer Community. The first subfolder is always 1.0 and contains all available actions in form of tiny AppleScripts with the file extension .scpt. The Nuimo application scans these folders and makes all actions automatically available to you.

Each action is a tiny AppleScript that tells the Nuimo controller what to do when you have pressed its button, swiped over its surface, etc. Let’s take the action New Tab.scpt — it tells Nuimo to open a new tab in Google Chrome browser. If you open this file it will reveal its content inside AppleScript Editor:

When creating your AppleScripts or troubleshooting, you must take care that the application name (e.g. “Google Chrome”) is spelled correctly so that it will work properly. You can always check this name inside your user folder/Users/<Username>/Library/Application Support/Nuimo/Application Actions.

Now You’re Ready To Share!

Named properly? Tested? Awesome! You can now submit your script to share with the community. There are three ways to share:

1. Sharing via Email with Team Senic

The easiest way to share your actions is to simply email them as file attachments to [email protected]. We’ll then take care to publish your actions with the whole community.

2. Sharing as a GitHub Issue

If you are a little more into open-source projects you might be familiar with GitHub, this is where all Nuimo AppleScripts are stored. By opening a new issue you can either discuss new actions or submit your suggestions for new actions. Please note that you need to signup for a GitHub account before creating or suggesting new AppleScripts.

3. Sharing as a Pull Request

For those of you who are already familiar with how GitHub works, we encourage you to submit Pull Requests that contain your application actions that you want to share with the community. In order to submit a Pull Request you will follow these steps:

  1. Fork the community repository for Nuimo actions into your own repository. How to fork a repository? 
  2. Add your new actions and commit them to your repository
  3. Create a Pull Request from your repository
  4. We will review your Pull Request and merge your Nuimo actions into the community repository

Support

If you have questions, ideas or just want to say hello — drop us an e-mail at [email protected].

Further Reading

Part 1/8: The Post-Screen Era is Upon Us.

smartphone ≠ smart home