Adobe Reader has N documents open. One of them has a known filepath and title and it needs to be programmatically closed. How to go about doing this in AppleScript? Specifically, how can I:

  • Talk to Reader
  • Access a list of documents currently opened
  • Select the document I need to close among the list above (I know: document path on the filesystem and document title, not necessarily "position" (e.g. frontmost, background, 3rd tab, or similar) or order in which it was opened)
  • Give Reader the command to close the file, not changing the active/frontmost document if the document to close was not in front of the user. Remembering which one was active, quickly switching to the one to close and back to the previous one is acceptable if it can be done almost imperceptibly

Hopefully this is a precise definition of the task, thanks for your help.

1 Answer 1


"Adobe Reader" is not really scriptable, you can't access to the objects (window, document), but You can use the GUI Scripting.

This script works well here.

set theTitle to "this name.pdf"

tell application "System Events"
    tell process "Adobe Reader"
        tell window theTitle to if exists then perform action "AXPress" of (get value of attribute "AXCloseButton")
    end tell
end tell

This script requires that you enable access for assistive devices in the Universal Access System Preference pane.

  • But if multiple files are opened it close all tabs no that particular doc Commented May 21, 2020 at 6:50

You must log in to answer this question.

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