Sergey L.
Sergey L.

Reputation: 22542

Tell PDF Viewer/Adobe Reader to go to page on OS X

I am trying to make an integrated presentation for my students.

System: OS X Lion 10.7

For that I need to show a foreground window running a 3D presentation which is remotely controlled by a command line on another screen.

Besides it I would like to show a small set of PDF slides behind it.

I need some way of "remote controlling" the backgrounded PDF Viewer (Adobe Reader or PDFView) to accept simple commands like

I prefer to run the PDF in Adobe Reader fullscreen mode (allows me to background it and overlay another window on top, but PDFView could do too.

I have tried various Applescripts (run with osascript), but with no success:

tell application "System Events"
    tell process "Adobe Reader"
        tell window "starkdemo.pdf" to key code 125
    end tell
end tell

sends key down to my terminal

tell application "/Applications/Adobe Reader.app"
    tell active pane of active window
        large scroll down 1
    end tell
end tell

gives me an error 63:69: script error: Expected end of line but found class name. (-2741)

Upvotes: 1

Views: 1771

Answers (2)

Sergey L.
Sergey L.

Reputation: 22542

I have found that the free Viewer Skim has extensive AppleScript scripting http://sourceforge.net/apps/mediawiki/skim-app/index.php?title=AppleScript

It also have the fullscreen view that I like. So I will be using this in the future. Also the applescript command is just one line:

tell document "starkdemo.pdf" of application "Skim" to go to page 7

Upvotes: 3

adayzdone
adayzdone

Reputation: 11238

Try:

activate application "Adobe Reader"
tell application "System Events"
    tell process "Adobe Reader"
        click menu item "Full Screen Mode" of menu 1 of menu bar item "View" of menu bar 1
        delay 2
        key code 125
        delay 2
        keystroke space
        delay 2
    end tell
end tell

Or try this with Acrobat Pro

tell application "Adobe Acrobat Pro"
    tell PDF Window 1
        read page down
    end tell
end tell

Or

tell application "Adobe Acrobat Pro"
    tell PDF Window 1
        goto page 3
    end tell
end tell

Upvotes: 1

Related Questions