APPLESCRIPT LIBRARY OPTIONS

In previous blog posts we explored some of the ways that AppleScript users can automate the process of writing and repurposing scripts. Some of the processes we looked at were:

  • Saving and reusing scripts as templates
  • Activating and taking advantage of resources in the Scripts menu
  • Creating and saving handlers as reusable text files in our own Handler folder inside AppleScript’s Scripts folder

Because most of the above involve folders in the User’s Library folder, they may not be easily available. Since version 10.6 of the Macintosh OS, Apple determined that it was dangerous to allow users easy access to all of the system files stored in the Library’s folders So unless you access these folders through a script, or find them tucked away in one of the folders accessed from the Script menu you may become a little frustrated.

If you are in the Finder and use Go to access your Library folder, Finder may tell you the that it can’t be found. But there is a secret to opening your Library folder for all to see. If you haven’t discovered it yet, here’s how:

Open your home folder (the one with the cute house icon next to its name). Click on it to activate it. Now use the keyboard shortcut Command+J. Aha! Before your eyes there is a little menu that allows you to check a box Show Library Folder. With this checked, the Library folder magically appears in your list of folders.

If you have other users working on your computer, you may wish to keep this folder hidden and only activate its visibility when you need access.

INDESIGN’S USERS SCRIPT FOLDER

Another folder that is quietly hidden inside of your Library folder is Adobe InDesign’s User Scripts folder. You can get the path to this folder easily by running the following script with Adobe InDesign CC 2015 running in the background:

Talk about “folder diving”. This one is for the record. 

 Once you have followed the path to open the folder, you may want to add it to your Favorites list as you may be placing files there shortly.

Another way to access this folder is through InDesign itself. Bring InDesign to the front. If you don’t have the Scripts panel as part of your Panel group, open it from InDesign’s Window menu (Window > Utilities > Scripts). 

You will find two sets of scripts in this panel. The scripts in the top collection are located in InDesign’s Application folder. Those in the lower collection are the ones we will be interested in for the purpose of this post

Click on a script to run. Or Control-click on a script to open the Script contextual menu from which you can manage the script.

ADDING SCRIPTS

Adding scripts to the Users Script folder is as easy as dragging and dropping now that you have its reference in your Favorites list. Once you have scripts in this panel you will want to add keyboard shortcuts to the ones you use most.

SCRIPT KEYBOARD SHORTCUTS

Creating keyboard shortcuts is where the fun begins. If you are not familiar with the process, follow along:

    1. Near the bottom of InDesign’s Edit menu you will find the Keyboard Shortcuts menu item.
    2. Choose Keyboard Shortcuts from the menu to open the following dialog


  1. If you don’t have an entry for your scripts in the Set list, give your script collection a name.
  2. Disclose the Product Area dropdown and select the Scripts option. Notice, while there, the other areas of the InDesign workspace that you can add keyboard shortcuts to.
  3. Scroll through the list of scripts to find the User Listing. Notice that all of the scripts in this folder have the User folder reference prepended to its name.
  4. To add a keyboard shortcut to a script, activate it. If there is a current shortcut assigned, it will be shown in the Current Shortcuts field.
  5. If no shortcut is currently assigned, select the Context to which you want it assigned. That is, if you want something other than Default.
  6. Key your keyboard shortcut into the New Shortcut: field. This is the key combination you want to use for the selected script. If this shortcut has not been previously assigned, the message [unassigned] will appear under the New Shortcut field. Using the Option key with Shift and an alpha key is usually a good choice because most of these combinations are open for your use. (I use this keyboard combination for all of my scripts for consistency.)
  7. Once you have found a satisfactory keyboard shortcut for your script, click the Assign button.
  8. Repeat this process to assign shortcuts to all of the scripts you want to automate.
  9. Once you have added shortcuts to all of your most-used scripts, click OK.

You may want to attach a list of your keyboard shortcuts to your computer as a reminder until you have committed them to memory.

HintYou may want to use an Option+Shift combination with the same letters used in famliar Command+key shortcuts. For instance: Command+N is standard for creating a new object on the Macintosh. In InDesign Command+N opens the New Document dialog. For a script that starts a new story, or creates a new document from a template, Option+Shift+N would be a logical choice for a shortcut.

Test Your Keyboard Shortcuts

Make sure your scripts work as anticipated when launched using your shortcuts. As an example, I have an Import MSWord script that is launched with Option+Shift+W (for Word). When this keyboard shortcut is entered with InDesign active, the user is prompted to select a Microsoft Word file to import. The script makes sure preferences for this file type are set, places the story to the active text frame (or insertion point), and performs some other time-saving processes.

ONWARD AND UPWARD

I mention the Import MSWord script just to preface next week’s blog post. This has to do with a workflow that may be of interest to you: Using Google Docs. If you need to accommodate a collaborative workflow with people who don’t have Adobe InCopy, Google Docs provides a handy option. There are several workflow options that may interest you. To make the workflow easier, you have two options:

  1. Pay $200 to buy an InDesign plugin (DocsFlow) from EM Software
  2. Write a script that places a Microsoft Word version of the Docs file in your active document. The script also fixes some of the formatting issues that inevitably come with a Microsoft Word file.

I am sure you have already guessed what my preference is. The nice thing about the scirpt is that you can use it with any Microsoft Word file not just one downloaded from Google Docs. Something to think about. But we will leave the rest of this discussion until next week.