Automatic Prompt to Mount and Unmount Disk Image

There may be an easy answer to my question relating to storing DTP DBs in 1 encrypted sparse disk bundle. It would be helpful to have a workflow that automates the following process I currently use: (1) click on an alias to the encrypted disk image, (2) enter the password to mount the disk image (it’s not stored in my keychain), (3) open DTPO, (4) use DTPO, (5) quit DTPO, and (6) eject the mounted disk image. Has anyone come up with an automated workflow to simplify this process?

It seems like there are many times I start DTPO but forget to mount the disk image first and/or forget to eject (unmount, I think is the term) the disk image after quitting DTPO. This drives me crazy!!! I know, it’s only a couple of extra steps but if you use periodically use the program throughout the day, it really adds up over time. In any event, it seems like I only use it when I feel like I have significant dedicated time to work. Also, there is the risk that you forget to unmount your disk image.

It seems like there should be some way (maybe there is but I just cant’ find it in the forum) to have/make a simple workflow that combines 1-3, and another that combines 5-6 above and have both run automatically on open and quit.

I tried to automate this process and tried the following: (I’m a newbe so please forgive me in advance if I’m not probably using the term “workflow”): In automator I tried to at least develop a workflow to combine steps 1-3. I’m able to “select the disk image” but can’t seem to make it prompt me to enter a password to get it mounted (obviously I don’t want to store the password in my keychain so I’m okay with having to enter the password). I assume if I can get to the second step, I could then have automator open DTPO - I haven’t gotten that far, I assume that’s possible.

Regarding the workflow on quitting DTPO, I don’t know if you can somehow have DTPO first trigger a workflow to eject/unmount the disk image right before I quit it. Obviously, also having it first verify/repair and compact the DTPO before it closes as well would be a bonus.

Any thoughts or advice? Thank you in advance.

Having an external process manage the workflow you describe is better than scripting DEVONthink to trigger it. Because steps 3, 4, and 5 could occur across an interval of two minutes or two days - I agree that splitting this into steps 1-3 and 5-6 is the better approach. Two macros built with QuicKeys, or Keyboard Maestro, or Butler, or Quicksilver (there are other approaches) would be the way I do it. At the end of the first macro, I’d tell Growl to put up a persistent notice on my screen to remind me to do the second macro.

One possibility for the first 3 steps might be an Automator workflow:

  • Create a new Automator workflow
  • Drag & drop the disk image into the workflow
  • Add the action “Mount Disk Image”
  • Finally add the action “Launch Application” and select “DEVONthink Pro” in the popup menu

I agree with Christian. A very simple method would be two Automator workflows: one that mounts the disk and launches the app, the second that quits the app then ejects the disk. These could be triggered with any number of mechanisms, as korm suggested (Launchbar, Quicksilver, as well as from the dock, etc.)
It would still be up to you to do any repair, compact, etc. (unless this is scriptable within DTP (I’m still learning the dictionary for it)), but this might be a quick route to go. (I made my workflows in about two minutes.)

Cheers! 8^)

Thanks, for the advice. I do recall seeing an app in the Mac app store that goes on your menu bar and will automatically eject a mounted disk image before your computer goes to sleep. I thought that might be good but then realized your computer could go to sleep, the disk image would be unmounted but DTP could still be open - and I assume that would be bad. Thanks again!!

I was able to get the workflow to do Step 1 (“Select the disk image”). I also included step 2 (“Mount Disk Image”) and then step 3 (“Launch DTPO”). This didn’t seem to work - it would ultimately just opens DTPO.

I think I figured out is that at step 2 (“Mount Disk Image”), it doesn’t prompt me for the password and just goes to step 3 (“Launch DTPO”). Given that, I went back and left in step 1 (“Select Disk Image”) but I added a different step 2 (“Open in Finder”) and left step 3 (“Launch DTPO”). What happens when I run that is that it asks for my password to mount the disk image; however, it doesn’t wait until that step is complete before going to step 3 (“Launch DTPO”). Is that just the way it work in automator? I couldn’t find any way to have it stop at step 2 and wait for me to enter the password before going to step 3.

I did find the automator action item called “wait for user action” but that doesn’t seem to stop the workflow to give me a chance to enter the password. I also tried to replace the “Launch DTPO” action in step 3 with “Open DTPO DB” but in either case, it automatically goest to step 3 without waiting for step 2 to finish.

Ideally, it would prompt me for the password and either (1) if the password is entered and the disk is mounted, it would then go to step 3 and open DTPO, or (2) if the disk image isn’t mounted for whatever reason, it would stop the workflow and not go to step 3.

Maybe this is just a limitation in automator and it doesn’t use the if then type logic. Again, if you have any suggestions, I would appreciate it. Thanks again.


The Automator workflow should wait for your input. Here is the quick workflow (saved as an application)…

Is it not working for you with this?

Note: You could add a Launch Application too to bring DTPO to the front.

This is my suggestion. I saved it as an “application” and it works here with a password protected sparseimage outside Automator:


Step 3 “Ask for confirmation”: Brings up a confirmation window which ensures, that Step 4 is not processed before you have confirmed that you have entered the password. If you click “Cancel” the workflow will be stopped.

Step 4: I would prefer to use “Open Database” (instead of “Launch Application”) here, because it let’s you open the database (and in a second workflow, when you want to close it) independently from DtP running with other databases opened.

Step 5: Add this if you want to come DtP to front otherwise you don’t need this step.


Just curious if my workflow did not work for you.

Hey Jim,

first I didn’t try, because I had experienced - just as Chris did - that the action “Mount Disk Image” does not bring up the password prompt and also - see Chris - does not wait for the user typing the password and directly continues to go to the next step, which is “Open database”.
Since you’ve asked I rebuild your workflow here and my findings are: It works as described, but it does not work for Chris as he uses a .sparsebundle image and not a .dmg as you did with your workflow.
The description of the action seems to be very exact:
It does not mount images that are .sparseimage or .sparsebundle, which explains why there is no password prompt using this action. It only mounts ‘simple’ .dmg images.

Further on you have marked the action “Wait for user action” in your screenshot. This action works here within Automator but outside Automator the dialogue window does not show. There is an option to run a script that actives Automator or Automator Launcher to bring up that window, but as the action “Ask for confirmation” works without flaws I decided to suggest this instead.

Chris, you have surely figured out yourself the steps in Automator to quit DtP (or close the database without quitting) and eject the volume (not the image) that contains the database.
I just want to leave the recommendation, that you set a small “Pause” in Automator between the two steps, because ejecting the volume might fail should DtP be busy and has not closed the database before Automator action already tries to eject the disk. To avoid this I think a pause of 5 seconds (at least) should be sufficient.

First, I know you both jumped in to help on this right away so I’m sorry for the delay in responding. Second, thanks for all your help on this. This was my first time using automator so it was quite a learning experience (I should have tried something easier)! I really like DTPO but it’s funny how I would find myself not using it just because I had to go through 3 or 4 extra steps.

For any newbies out there like me, I would point out one fundamental problem I had that isn’t addressed above. That is, I saved the file as a workflow versus saving it as an application!

Again, I really appreciate both of you taking the time to walk me through some of the basics!!


Glad you’ve got it all worked out now, Chris! 8^)