Skip to content

August 3, 2005


Automator and FileVault

Update: Jan tells us that in Leopard this issue is fixed. I have not tested it myself, but I certainly trust her.

Truth be told, I’m an AppleScript junkie. I love how easily I can write a simple program to give me a better or more natural interaction than it was designed for. As a result, I’m also a huge fan of Automator, which builds on AppleScript and makes development even easier (It reminds me of programming SCEA’s Carnage Heart).
Anyway, trying it out I discovered that Apple ran into an AppleScript bug that’s been around since Panther, and I can’t believe hasn’t been fixed.

The bug manifests itself as an “Applescript Error” such as :
– “Can’t get properties of alias”
– “Can’t get file type of alias”
and is followed by (-1728).

What’s going on here is that the AppleScript hooks in the Finder can’t cope with FileVault. I tried programming an Automator Action based on Jan Bardi‘s AppleScript, but the resulting alias still causes these errors.

The only workarounds are to move files into a working directory and then move them back, or to turn FileVault off. I did the former.

To do this in a workflow:
1. Create a folder somewhere outside of FileVault (I created a “Scratch” folder on my startup disk)
2. Use either the “Copy Finder Items” or “Move Finder Items” Finder Action near the start of your workflow and set the folder in step 1. as the destination.
3. At the end of your workflow, use the “Move Finder Items” Finder Action and you can set your destination back in a FileVault folder.
You probably want to check the “Replacing existing files” checkbox in both of these Finder Actions.

Now your workflow can cope with FileVault, though not securely. A malicious program might monitor such working folders and copy their contents elsewhere, but if it’s going to a be a workflow running on a private machine, it’s most likely safe.

Read more from Technical
8 Comments Post a comment
  1. Nov 4 2005

    Funny, I get the same error, but I don’t have FileVault on, and never have. Hmm, thanks for writing about this anyway.

  2. Conrad
    Nov 4 2005

    It might have to do with some characters in your drive’s name or in the name of the file or it’s containing folder. Basically, the error indicates that Applescript can’t parse the filename. In the case of FileVault, all user files are under a hidden drive mounted in /Volumes/.username which then is redirected to /Users/username. AppleScript can’t cope with that. An error for a non-FileVault file is likely a similar access problem.

  3. Bob
    Jan 15 2006

    This happens (at least, it happens to me) with any file that is on a different volume from the boot partition. I don’t know a solution other that copying the files to someplace like /private/var/tmp and then copying them back when you’re done.

  4. David
    Feb 1 2006

    The error appears to be due to “true paths” vs. aliases of a the home directory and the added “.sparseimage” to the name when using FileVault. The finder uses aliases that brake with FileVault because it does not recognize the “alias”.sparseimage

    In 10.4.4 (Tiger) your home directory’s “true path” is more like “/Users/.username/username.sparseimage”

    example: If your Username = sombody

    Then your true “UNIX” path to the uppermost tear of your home directory is actually found at /Users/.sombody/sombody.sparseimage

    I have had some success feeding the finder a UNIX path and UNIX command outputs [instead of relying on the finder aliases that break].

    To do this, I use the “run a shell script” (bash/stdin defaults) with an echo command. There’s probably other ways to do this but it seems to work good for me.

    Inside the text field of the “Run Shell Script” given the username “somebody” you would type the following:

    echo /Users/somebody/Documents

    Then feed its output into “Copy Finder Items” or something else.

    The result of the echo above would place you inside of your Documents folder. The echo command itself just means “repeat these words.” So you could echo -anything- as an input.

    Another tip is that you can seperate UNIX commands and place them all in the same shell script by placing a ; in between your commands.

    if the following was entered:
    rm /User/somebody/Documents/oldfile; echo /Users/somebody/Documents

    The result would trash the “oldfile” and then output the “desired path” of your Documents Folder (to the next item listed in Automator).

    hope this helps,


  5. celi_v
    Mar 19 2007

    Brilliant! This has been driving me crazy, thanks a lot.

  6. adm
    Sep 1 2007

    thanks. this had been driving me crazy, too. i can’t believe it hasn’t been fixed.

    i took the option of created a temp folder at the root directory, manually copying all the images i wanted to resize into it, and then using subdirectory of the temp folder as the target. very simple, easy-to-repeat solution.

Trackbacks & Pingbacks

  1. Graph Paper » Blog Archive » The Downsides of FileVault
  2. » Blog Archive » Smooth Automator

Share your thoughts, post a comment.


Note: HTML is allowed. Your email address will never be published.

Subscribe to comments