I've been having an issue with a program I use heavily every day, where it it acts like it is recovering from a crash even when it was quit properly and all files saved. The app is FontLab Studio, not that it should matter. What happens is that it loads all the files I've worked on recently, which can be several dozen, and even if I click out of them all, it happens several more times throughout the day. Or, something causes it to crash as I'm exiting these files so that I have to relaunch and it starts all over.

What I've been doing to avoid this, is to run AppCleaner, the free uninstaller, and delete everything but the App itself and the license info. This works great, but given the frequency this is becoming necessary, I'd like to be able to create something I could access really fast, like an Applescript that I could put in my dock. Or an Automator service located in the contextual menu items.

I don't know any Applescript, but I tried to make an Automator workflow. The first step, "Get Selected Finder Items." One has a static location, the second may change, I'm not sure.

~/Library/Saved Application State/com.fontlab.studio5.savedState


The second step in the workflow is to move to the trash, and that's where it fails. I suspect because these require a password? If possible, it would be great if I could enter it once and it remember, otherwise, how I'll need it to prompt me to enter my passkey. I don't know the best way to do any of this.


I just had another thought, though it may not work as it would require FontLab to be open at the time, would be to accomplish this with a Python script, because FontLab is partially built in python and can install third party scripts. I am open to whatever help anyone could offer.

Thanks in advance!

1 Answer 1


I do not have FontLab Studio installed however for the purpose of providing a solution to your situation, under OS X El Capitan 10.11.5, I did the following:

  • In a Terminal at /private/var/db/BootCaches, using sudo, mkdir and touch I created a directory named 34D6C504-2F5B-416F-9C91-0C9D019BF446 and in that directory a file named app.com.fontlab.studio5.playlist.

  • In Finder, in my Home folder's Library > Saved Application State folder, I duplicated a folder and renamed the copy to: "com.fontlab.studio5.savedState"

In doing so this replicated the target locations and files with appropriate privileges to then test the following AppleScript application on.

In Script Editor I used the following code to create the Reset FontLab Studio.app and saved it in the Applications folder of the Macintosh HD and then dragged it to the Dock so as to have it readily available to click on.

    do shell script "rm -r \"$HOME/Library/Saved Application State/com.fontlab.studio5.savedState\" /private/var/db/BootCaches/*/app.com.fontlab.studio5.playlist" with administrator privileges
end try

When I click on the Reset FontLab Studio Dock Tile it showed the password dialog box, as shown below, for me to type in my password. I typed in my password and pressed enter. That's it, the app did what it was programmed to do.

Password Dialog Box


  • As this code is tested I'd suggest copying and pasting it as is into Script Editor and then saving it as an application of whatever name you desire.

  • $HOME is being used because ~ can/will at times error out in AppleScript and or Automator, depending on its specific use. Normally ~ is expanded to the value of Environment Variable of HOME and thus I typically use $HOME over ~ to avoid errors that it can/will generate at times.

  • The substitution of * for 34D6C504-2F5B-416F-9C91-0C9D019BF446 is intensional, so as to accommodate the possible name change.

  • The try command is used so as to avoid an error if you run the Reset FontLab Studio app again before the target files are recreated and or if one or the other doesn't exist, it still deletes the other.

  • /var is a symbolic link to /private/var however I prefer using the absolute path over the symlink in cases such as this.

  • The use of the rm command is inherently dangerous, especially when used with elevated privileges and or wildcards, so to that end make absolutely sure there are no typos in your command line and that the targets are the intended targets. This is why I tested my code before posting it. You can also preface the rm command with echo, e.g echo rm ... and then review the output in the Script Editor's Events/Results pane and then remove echo before saving the script.

The image below it to show syntactical highlighting and to see the full command line of the do shell script command

Script Editor window

If you're the only user of the computer and you like not to have to type in your password when the Reset FontLab Studio app runs, then modify the do shell script command using the following syntax:

do shell script "command" user name "me" password "mypassword" with administrator privileges


do shell script "rm -r \"$HOME/Library/Saved Application State/com.fontlab.studio5.savedState\" /private/var/db/BootCaches/*/app.com.fontlab.studio5.playlist" user name "me" password "mypassword" with administrator privileges

Note that when the script's code is saved the value of user name and password are saved in readable text within the application bundle's "main.script" binary file. So use this method at your own risk as it is considered to be a security risk storing user names and passwords that are stored in an unencrypted manner.

  • This is great thanks. I am sorry for the newbie questions. I know you said the asterisk was intentional, but I don't know enough about programming to know why/how it would accommodate the path change—not that I need to understand, I just want to confirm that I understood correct and that it will. Also I am the only user on my computer and I live alone but don't mind typing in my password with something quick and easy like this that I can run with a single click from the dock, especially for security.
    – Moscarda
    Commented Jul 26, 2016 at 1:29
  • @Moscarda, Without getting into the technical details, essentially what happens is if the app.com.fontlab.studio5.playlist file exists in the path of /private/var/db/BootCaches/*/ where the * is any directory existing in the BootCache's directory that also contains the app.com.fontlab.studio5.playlist file, then the file is found and is deleted. The asterisk is a wildcard that can represent any number of characters (including zero, in other words, zero or more characters) and in this instance is perfectly harmless and is safe to use as is. Commented Jul 26, 2016 at 2:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .