Scripting FontAgent Pro

Posted by scottstoel on April 5, 2009 at 5:29 pm.

One of the least known features about FontAgent Pro 4 is that you can automate it using AppleScript.


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,

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
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.