Automatically Opening Secure Images

Although encrypted records would be great, I’m beginning to recognize the power of using the secure images to store entire libraries in an encrypted manner. However, that said, it is a bit of a pain in the butt to mount and navigate to the eflibrary to open the library. I was going to ask for some sort of shortcut to quickly access the secure images, but realized that two very simple AppleScripts would do the trick.

To open the file (change the image name):


tell application "Finder"
	do shell script "hdiutil attach /Users/me/Secure.sparsebundle"
end tell

tell application "EagleFiler"
	open "/Volumes/Secure/Secure.eflibrary"
end tell

And to close the file (again, change the name):


tell application "EagleFiler"
	close front window
end tell

tell application "Finder"
	do shell script "hdiutil detach /Volumes/Secure"
end tell

Hopefully someone else knows a more robust way to grab the proper window instead of just assuming that the front one is the right one.

For opening a library, you don’t need AppleScript. You could just make an alias of the “Secure.eflibrary” file or put it in your Dock.

To close the proper library, I recommend a script like:

tell application "EagleFiler"
    close library document "Secure.eflibrary"
end tell

This will close all the windows for “Secure.eflibrary”.

Is there some way to automount the volume as well? I keep my Secure library closed unless I’m working on it. I also keep the password out of the Keychain.

To close the proper library, I recommend a script like:

tell application "EagleFiler"
    close library document "Secure.eflibrary"
end tell

This will close all the windows for “Secure.eflibrary”.

Thanks, that’s just what I was looking for - my AppleScript fu is weak!

Yes, it will automount when you open the alias or click the icon in the Dock.

Me, too.

That’s awesome! I had no idea. Perhaps now I’ll have to put that to other uses elsewhere. Thanks Michael.

EagleFiler 1.5 adds a Close & Lock command so that this script might no longer be necessary.