Posts Tagged ‘scripts’

Launching Smasher from FontAgent Pro

Monday, April 18th, 2011

One of the great, unique features of FontAgent Pro for Macintosh is its ability to automate font management tasks using AppleScript. On the right side of the FontAgent Pro menubar is a script icon that lists scripts that ship with FontAgent Pro as well as those you add yourself.

FontAgent ProScreenSnapz006The scripts that come with FontAgent Pro work directly with FontAgent Pro, but you can add scripts that run other applications as well.

Below is a script that launches Smasher, Insider’s font and cache maintenance utility. If you would like to download the script click here. Unzip the attached file and place the script in the /Library/Application Support/FontAgent Pro/Scripts/ folder to get it to appear as Launch Smasher in the FontAgent Pro > Scripts menu.

set appFolder to (path to applications folder as Unicode text)
set afolder to appFolder & “Smasher”
tell application “Finder”
if exists folder afolder then
try
tell application
“Smasher”
activate
end tell
end try
else
tell application
“Finder”
activate
display dialog “You do not have Smasher installed. To learn more about Smasher and download a demo click \”Learn More.\”" buttons {Cancel, Learn More} default button 2
if the button returned of the result is “Learn More” then
set theURL to “open http://www.insidersoftware.com/SM.php”
do shell script theURL
else
– nothing happens
end if
end tell
end if
end tell

Note:  If you copy and paste the text into Script Editor, depending on the browser you are using, you may need to do a find-and-replace on the quotes to get them to be dumb quotes. ScriptEditor will see a smart quote as an unknown token and the script will not compile. You can view and edit the linked script after you download it if you wish.

This script is handy because when you start seeing symptoms of font cache corruption, it allows you to quickly launch Smasher from FontAgent Pro, where you can clear your caches and get back to your work. It is also a good idea to make sure you have Smasher’s cache clearing scheduled to run each time you start or shutdown your Mac.

When you run the script, Smasher launches and you can edit settings to clear your caches in any manner you wish. If you don’t have Smasher installed it  gives you an option to go to a web page where you can learn more about the product.


This script is offered as is and you may feel free to edit it in any way you wish. For example, you add scripts that launch other applications such as QuarkXPress or InDesign from within FontAgent Pro.

In future posts, we will talk more about using AppleScript to automate font-related workflows. Stay tuned to The Inside Scoop.

Automating Font Workflow with AppleScript

Monday, December 7th, 2009

Automating project workflow is crucial to today’s prepress and design workplaces. FontAgent Pro is perfect for these applications because you can use AppleScript to automate virtually all of its functionality.

AppleScript is an English-like language you can use to write scripts that automate the actions of your Mac and the applications that run on it. When you want your Mac applications to work together in harmony, AppleScript becomes the lingua franca that makes them all talk to each other. Using it, you and your applications become a lot more productive.

fapicon

If your project workflow uses fonts, FontAgent Pro is the font management tool you need to automate your workflow. While old versions of Suitcase supported AppleScript, the current versions of Extensis Suitcase Fusion 2 and Extensis Universal Type Server (UTS) client do not, nor does FontExplorer X.

How you can use AppleScript

There are lots of things you can automate with FontAgent Pro scripts. One of the most useful scripts imports and activates fonts when you drag a folder of fonts onto an AppleScript application.

Here is an example of how this might be useful:

It is common for prepress service providers to receive many different jobs from different clients during the day. Service providers usually receive fonts in a Package or in a folder created by a Collect for Output command. These fonts need to be imported into FontAgent Pro and activated to open the application file in the project.

Using AppleScript and FontAgent Pro, you can create a droplet application where you can drag the folder of files provided by a client (which in this example is named by job number) and the fonts contained will be automatically imported into a unique library with the same name as the folder. The script also deactivates all other fonts, and then activates the library you just imported so you can be sure you are using the exact fonts provided by the client. Without doing this, you cannot be sure that the job will rip and print as expected. After running this script, you are ready to launch whatever application your client used to create the application file and proceed.

fapdragactivatorimg

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, but if you have any questions or suggestions, you can contact us at Insider Technical Support.

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, or just download the script from the link provided above.

How to use the script

Simply take a folder of fonts and give it a name. This example uses a folder created from a package-for-output InDesign CS 4 project, and it’s named with a five-digit project number.

fontfolder2

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

folderscript

From the screenshot below, you 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.

libadded

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 the Insider Blog.