Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a sparse image that can be mounted as an encrypted volume. I want to make sure it doesn't stay mounted once I am done using it.

To get help doing that, I had earlier asked this question, but got no response.

So, I am asking this new, hopefully simpler question:

How can I do the following:

1) When the volume is mounted, a script should start running.

2) The script should ask even hour whether the volume should be unmounted, and depending on the response unmount the volume (If that is too complicated, this will suffice as well: The script should just attempt to unmount the volume, and indicate if the unmount failed due to the volume being in use)

3) The script should stop executing once the volume is unmounted (ideally by "listening" for its unmount event, or if that's not possible, simply as the next step in the script's execution once it has effected the unmount -- the former having the benefit that even a manual unmount would end the script)

I have only very recently moved to the Mac from Windows and have no experience with AppleScript. So, a working script would be ideal, but if I am given pointers on how to carry out the individual steps, I should be able to piece them together as well, hopefully.

Thanks.

share|improve this question

1 Answer 1

Here is a way to accomplish most of this using a simple Automator script:

enter image description here

Save the script as an Application. Place on desktop or dock. When you want to open the encrypted disk image, simply drop it onto the script icon and it will mount it, pause, and ask for confirmation from you to close the disk image after a certain amount of time has elapsed. The only thing here is that if you choose not to have it unmount, you will need to manually unmount later. You can also remove the confirmation prompt altogether. Then you will simply get an error message if it tries to unmount while still open (which should also stop the script from running).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.