An AppleScript to bypass the annoying "add to library" dialog in ADE 3.0

RSS  •  Permalink  •  Created 16 Jun 2014  •  Updated 25 Jun 2014  •  Written by Alberto Pettarin

If you happen to open several EPUB files a day in Adobe Digital Editions 3.0, you will probably know well this infamous dialog:

Blog Image ade.png

If you click the Don't show this alert again checkbox, the dialog will not show up again, but only until the running instance of ADE is alive. Close it, open another EPUB file, and you will get the dialog again.

Laura Brady asked if there is a magic way to close that dialog, and, without knowing better, I suggested using an AppleScript that loops, waiting to detect the dialog and, in case, sending the correct keystrokes to emulate the user clicking on the Cancel button.

The following code works for me, but I am not an AppleScript (nor OS X) expert, so use at your own risk!

tell application "Adobe Digital Editions 3.0"
            tell application "System Events"
                    set forever to false
                    repeat until (forever)
                            if (window 2 of process "Adobe Digital Editions" exists) then
                                    tell application "System Events" to tell process "Adobe Digital Editions" to key code 48
                                    tell application "System Events" to tell process "Adobe Digital Editions" to key code 49
                            end if
                            delay 1
                    end repeat
            end tell
    end tell

(Codes 48 and 49 represent the tab and the space keys.)

The usage is simple:

  • copy the above code in an AppleScript;
  • before beginning your ADE-intensive work session, run the script;
  • when closing an ebook, the dialog will popup as usual, but the script will close it for you;
  • stop the script once you are done with your ADE-intensive session.

Note that this is a very crude approach, and maybe someone has a better trick at hand. If you use ADE frequently (fortunately, I do not) you probably should urge Adobe to fix this issue. The script should be refined, at least to make sure that window 2 is the dialog we want to close, and not something else, but I have to go back to serious stuff now...

Another approach (updated 2014-06-25)

A slightly different approach, suggested by Joshua Tallent, consists in a script to simply kill the ADE process. You might also want to add a key shortcut to it.

Open Automator, create a new "Service", select the "Run AppleScript" Action.

Set "Service receives no input in Adobe Digital Editions 3.0".

Blog Image ade2.png

You can copy/paste the following code in the script panel:

on run {input, parameters}
    tell application "System Events"
        if (application process "Adobe Digital Editions" exists) then
            do shell script "killall 'Adobe Digital Editions'"
        end if
    end tell
    return input
end run

Now, save the service (e.g. as "CloseADE"). Open the menu Automator > Services > Services Preferences... and scroll down and assign the key shortcut you like:

Blog Image ade3.png

Yay! No more annoying dialogs!

Note: killing processes here and there is not really a good practice. Use with caution. Urge Adobe to solve this bug.