0

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.

1
  • I am new so I really am sorry if I am not adhering to rules and such around here by the way this answer goes. I have the same question. I found this, didn't check it much and don't really have the knowledge, but might this be relevant? docs.oracle.com/cd/E19455-01/806-0916/6ja8539g7/index.html Cheers
    – stultitia
    Oct 20, 2014 at 23:32

1 Answer 1

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .