0

Hey everyone I am new to applescripting. I have a need for an applescript that will cycle through 3 PDFs, located out on a share drive. I have the script but the problem is that if a user overwrites the PDFswith a new version, the script continues cycling through using the old version, not the updated copies. So I thought that if the script could close the PDF window and then reopen it that might would work. However, I cannot get it to close the window. Here is what I have so far and it does not work. Throws an error saying Access for assistive devices is disabled which it is not.

repeat
tell application "Adobe Reader"
    open "/Volumes/Schedules/Maintenance/DowntimeData.pdf"
end tell

delay (60)

set theTitle to "DowntimeData.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

tell application "Adobe Reader"
    open "/Volumes/Schedules/Maintenance/MaintSchedule.pdf"
end tell

delay (60)

tell application "Adobe Reader"
    open "/Volumes/Schedules/Schedulev4.pdf"
end tell
end repeat
1

It worked for me. Are you sure access for assistive devices is enabled (in the accessibility preference pane)?

You could also try running tell application "System Events" to set UI elements enabled to true. Or something like removing /var/db/.AccessibilityAPIEnabled, turning the setting off and on, and restarting.

You must log in to answer this question.

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