then File > Save As... > File Format: Application and saved to the Applications directory. Then I went to System Preferences -> Accounts -> (choose user) -> Login Items and added that new script (application) there, so it would start automatically after Login. But, this pops up a UI that gives you the option to use password or key files. I only wanted to provide a password. I also thought it would be cool to have a shell script to run on OS X login in Terminal.app that I could keep in my home directory and modify at will with a text editor rather than AppleScript Editor. So, I wrote the following AppleScript in AppleScript Editor and again used File > Save As... > File Format: Application to the Applications directory. Then went to System Preferences -> Accounts -> (choose user) -> Login Items and added that new script (application) there, so it would start automatically after Login. (I also removed the other one I'd created.)
do script "/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt /path/to/volume/file/volume.tc /path/to/dir/my_encrypted_dir"
Then I created a file ~/.login.sh containing:
tell application "System Events" set terminal_is_open to (exists process "Terminal") end tell tell application "Terminal" activate if terminal_is_open then tell application "System Events" to tell process "Terminal" to keystroke "n" using command down end if do script with command "~/.login.sh" in selected tab of the front window end tell
Then I did:
#/usr/sh # Things to run on login... clear # Mount encrypted volume /Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt -t -k "" --protect-hidden=no /path/to/volume/file/volume.tc /path/to/dir/my_encrypted_dir
Logout, login, and it should display a Terminal.app window prompting you for your password to the TrueCrypt volume. After that, I just leave the window open in case there is an error. Note that to rename the TrueCrypt volume mount on the desktop, just rename it like any other file.
chmod +x ~/.login.sh