|
|
Quick Applescript to Mount Disk Image
I'm no programmer, but I whipped this up to automate the
processing of mounting the encrypted disk image prior to
launching Mail. Please post corrections and/or
improvements.
It would also be very cool to combine this hint with this one regarding sparse images that grow to fit.
set afile to "Users:markd:cryptonite.dmg"
tell application "Finder"
if the disk "cryptonite" exists then
return
else
do shell script ("hdiutil mount \"" & ¬
POSIX path of (afile as string) & "\"")
end if
end tell
tell application "Mail"
launch
end tell
Quick Applescript to Mount Disk Image
This is far from ideal/finished, but I wanted to automate the
process a little more. I'm using the system to secure my Notes
library, so anyone using this with Mail could just replace "Notes"
with "Mail" in the appropriate places.
Basically the idea is to have a script which mounts the disk image and launches the program and then sticks around so that when the application is quit, the secure disk image is unmounted. Save the following script as an application, and check the "Stay Open" box and the "Never Show Startup" box. You should call your application "CryptoNotes" or change the 6th line from the bottom to whatever you call it. On run, the program runs the parent comments' script. It then pauses for a while before going into it's idle state, in which it checks whether the application in question is still open every 5 seconds (this is a very processor-friendly call, but you could increase this time interval if you really want to). Then, when you quit Notes, CryptoNotes ejects the secure disk image, and quits itself (sometimes the second action occurs 5 seconds after the first). Your files are not left lying around unencrypted.
This works okay for me, but could be improved. The biggest
kludge is the
Quick Applescript to Mount Disk Image
You could set up a cron job to check if Notes i running and, if not, have it eject the image if present. I could imagine that this might create rare problems if, for instance, the cron job runs between disk mount and app launch, but doing it this way would make it independent of an AppleScript that might crash and not be running when needed. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|