all things type…

Category Archives: AppleScript

One of the challenges in a font-based workflow is the difficulty determining what fonts are used in a document without launching the document. Many times in InDesign you can use the Package command, which will save a report of the assets used in the creation of the document. This command is commonly used when collecting document assets for a service provider, but not used in most designer’s day to day operations.

Unless you integrate that feature into your workflow, you are required to launch InDesign, open the document, and use the Find Fonts command to access a comprehensive list of the fonts used in the document. Depending on the size of the file, this can take a while. If your document uses many fonts the Find Font dialog window does not expand so you can easily examine the whole list.

AppleScript offers us another way. In this post we are going to instruct you on how to use a script we developed at FontGeek that allows you to get a list of all the fonts used in an InDesign document without having to launch the document, or even have InDesign installed on your system, and then save a report if you wish.

First download the compressed AppleScript application here, then unzip the file.

Then drag and drop an InDesign doc onto the script icon. You will be prompted with the message below:

Click OK and the script will search through the InDesign document, gather the fonts used into a list and display them for your examination.

At this point you can dismiss the dialog, or save a copy of the report to the location of your choosing with any name you wish. The report can be read with most any text editor.

This script does have some limitations, such as only processing one document at a time. Also if no fonts are used in the document, the script simply lists no fonts. In short, this script could be made both “smarter” and “prettier” but it is still a very useful tool to bring more transparency to your workflow.

The script is provided as is, which means you are using the script at your own risk, and I will not answer emails for support. I am happy to answer any questions you might have and you can reach me at my email, scott@fontgeek.net.

Stay tuned to FontGeek for more about using AppleScript to automate font-related workflows.

For those of you unfamiliar with AppleScript, it is an English-like language used to write scripts that automate the actions of your Mac and the applications on it. In short, when you want your applications to start working together, you can turn to AppleScript. It is the lingua franca that helps your programs and you become more productive.

Not all applications will let you use AppleScript, and not many font managers do. FontAgent Pro from Insider Software supports Applescript as does MasterJuggler. Previous versions of Suitcase supported AppleScript, but the current version of Suitcase Fusion 2 does not. FontExplorer X doesn’t either. So if you have a workflow that uses fonts and you want to automate it with scripts, your choices are limited.

How we can use AppleScript

There are lots of things we can automate with FontAgent Pro, but one of the most useful scripts is one that handles the import and activation of fonts by dragging a folder of fonts onto a AppleScript application.

Let me give you an example of how this might be useful:

In the past, I was employed as a pre-press technician. It was common for me to receive many different jobs from many different clients during the day. The fonts (which they usually gathered using a Package or Collect for Output command) that accompanied the project needed to be imported into FontAgent Pro and activated for me to move forward.

So what I did by using AppleScript and FontAgent Pro was create a droplet application where I would drag the folder of files provided by a client (which was named with the job number) and the fonts contained would be automatically imported into a unique library with the same name as the job number. The script would also deactivate all other fonts in my collection, then activate the library I just imported. At that point I would be ready to launch their project in whatever application they used and proceed.

What is provided below is not intended to be a lesson in the basics of AppleScript. There are other much better resources for that sort of thing. If you just want to get the script and start rolling, you can download it here and unzip it on your desktop and you are good to go.

The script is provided as is, that means you are using the script at your own risk, and I will not answer emails for support. I am happy to answer any questions you might have and you can reach me at my email, scott@fontgeek.net.

The script

The text for the script is below:

on open these_items
set afolder to these_items
set {name:folderName} to info for afolder
try
tell application “FontAgent Pro”
set DB to default database
tell DB– this section deactivates all fonts in FAP
set LibList to every library
deactivate fonts LibList — get the path to where libraries are kept and returned a as a POSIX path
set LibFolder to library path of first library as POSIX file — build path to new libary
tell application “Finder” to set libpath to POSIX path of (container of folder LibFolder as string) & folderName
end tell
set NL to new library in DB with properties {library name:folderName, library path:libpath}
import fonts afolder options {destination library:NL, activate after importing:true}
end tell
on error the error_message number the error_number
display dialog “Error: ” & the error_number& “. ” & the error_message buttons {”OK”} default button 1
end try
end open

If you copy and paste the text into Script Editor, you may get a syntax error when you attempt to compile the script. This is most likely because the quotation marks in the text are “smart quotation marks” or curly quotes as opposed to the straight “dumb quotation marks.” Just do a find and replace with the dumb quotes and you can edit the script from there.

How to use the script

Simply take a folder of fonts and give it a name. I used a folder created when I packaged an InDesign CS 4 project for output.

Drag the folder onto the FAPDragActivator icon on your desktop and let the script do its stuff.

From the screenshot below, we can see that the fonts were imported into FontAgent Pro (in a library named after the folder) and are indicated active with a green activation sphere. Also notice all the other fonts in the collection are deactivated.

The fun doesn’t have to stop here. This script can be integrated into a larger script that further automates your workflow. This script could activate the fonts and could hand the document off to InDesign or QuarkXpress to print a soft proof using a preset print setting.

In future posts we will talk more about using AppleScript to automate font related workflows. Stay tuned to FontGeek.