December 9, 2015

JavaScript for OS X Automation in TextExpander

JavaScript for OS X Automation

This week's tip is a brief example of how to use JavaScript for OS X Automation in TextExpander. TextExpander started supporting JavaScript for OS X Automation or (JAX) in version 5.0.

JavaScript for OS X Automation is Apple ways of opening up key Applications to create tiny time-saving Applications. You don't need to be a programmer to appreciate the power of this new functionality in OS X Yosemite.

I'll show you how to set up a simple TextExpander Snippet to view a Jira ticket with whatever text is in the clipboard. This is a quick way to view a ticket if you don't have a link to click on.

Create the following JavaScript Snippet in TextExpander:

Browser = Application("Google Chrome");
window = Browser.windows[0];
window.name();
myclipboard = "https://company.atlassian.net/browse/" + "%clipboard";
tab = Browser.Tab({url:myclipboard});
window.tabs.push(tab);

Note: This particular snippet is using Google Chrome, you can change the browser type to 'Safari' or 'FireFox' if you would rather use those browser types.

Change the Atlassian URL to whatever the URL that your company is currently using for their Jira installation.

I assigned '.doit' as the abbreviation, so its unique and simple to remember.

Now when I get an inquiry about an issue via Slack, I just copy the issue number and type in the abbreviation. Google Chrome opens up a new tab and the Jira page is displayed.

This is a very simple implementation, but what's cool is that I can easily modify this to open up multiple tabs to do something else. For example, I can easily open up two tabs to handle the same query. So I could search for something in Jira in one tab and at the same time have another tab search Papertrail for the same clipboard data.

I am excited to see JAX implementation in TextExpander. I believe that there's a lot of opportunities to make me more productive.

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!