Skip to content

Posts from the ‘Technical’ Category


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.


Display Rotation Script

One of my favorite features of Tiger is the ability to rotate the display. My fabulous friends and family got me a Dell 2005FPW for my 30th birthday, and being able to rotate it to read code and research papers is a tremendous treat.

However, I find it a nuisance to click the display preference Rotate pop-up button, then turn the display, and click the confirm button before my 15 seconds are up.

To simplify that interaction, I’ve written two scripts to do the clicking for me. One rotates clockwise, the other counter-clockwise. If you think that would be useful to you as well, please, help yourself. Add them to your Finder applescript menu, or add them to a hot key launcher (in my case, I added two Triggers to Quicksilver)

Update 2007.01.10: I’ve tested the scripts in Leopard (10.5.x) and everything still works.

Update 2006.03.04: I’ve modified the scripts to handle rotation of displays with the same name. (thanks for the pointer David!) Please download them again and overwrite the old scripts.


Swapping Modifier Keys Seperately on a Notebook and External Keyboard in Mac OSX Tiger

I finally upgraded to Tiger this weekend. It went painlessly, which is always a surprise to me. I feel like upgrading an OS is like a driver and passenger swapping places at 60 mph on deadman’s curve.

There has been plenty said about Apple finally including the ability to trivially swap modifier keys in the new Keyboard & Mouse Preference panel. As a result, it seems uControl development may cease. However, the common complaint from many users has been that they can not swap modifier keys on a per-keyboard basis. I use a external keyboard with my PowerBook when at my desk and need the command and option swapped on it, but not on my PowerBook. Here is my procedure for remedying this.

Note: This only works on older model PowerBooks and iBooks that used ADB keyboards. I do not have a solution for USB keyboard equipped PowerBooks. To find out if this will apply to you, run this command:

kextstat | grep

If you see a line that looks something like this:

57    0 0x2e3e8000 0x4000     0x3000 (2.3.8f2) <44 20 11>

Then your notebook is compatible with this hint.

The trick is to swap the the Command and Option keys for the built-in keyboard in the low-level keyboard driver and then use the Keyboard & Mouse Preference pane to swap them again. This results in the keys being swapped on both the external and the built-in keyboards.

I used the information on Heiko Hellweg’s site to do this.

Follow Heiko’s instructions as if you wanted to remap the ‘enter’ key and instead, or in addition to, when editing the ADBVirtualKeys plist key,
replace the one 0x37 with 0x3A and the following occurrence of 0x3A with 0x37.
This swaps Command and Option in the ADB driver.

As per Heiko’s instructions, delete the kernel extension caches and reboot.

Then you can go into the Keyboard & Mouse Preference pane and swap the modifier keys there. This should result in your external and built in keyboards having the correct arrangement of Command and Option.

I also had to edit all of my ControllerMate mouse button mappings to send Option instead of Command since the events sent by ControllerMate are still interpreted by the keyboard driver which now translates all Command presses into Option presses.