open pdf document

Hi !

I’m trying to write a script that open a pdf document at a defined page with Acrobat reader but i got some problems to use “goto”

can somebody help me ?

Thanks in advance!

Make sure you’re running Reader 6.0 or better. Post your code if you need help. Any errors in script editor’s event log?

I’m running reader 7.0,

my code is :

tell application “Adobe Reader 7.0”
activate
set nomFichier to “Users:xerces:Desktop:PDFOpenParameters.pdf”
open nomFichier
tell front document
goto first PDF Window page 2
end tell
end tell

i’ve got syntaxe error ( translate in english )
end of line foreseen but found " first ".

I couldn’t open reader Dictionary, i suppose problems are link.

Core events aside, I didn’t think Adobe Reader was scriptable*. However, you might consider a bit of UI scripting - perhaps something like:

to openPDF for f at p
	tell application "Adobe Reader 7.0"
		activate
		open f
	end tell
	tell application "System Events" to tell process "Adobe Reader"
		tell window (f's name) to repeat until exists
			delay 0.2
		end repeat
		keystroke "n" using {shift down, command down}
		tell window "Go To Page" to repeat until exists
			delay 0.2
		end repeat
		keystroke (p as string) & return
	end tell
end openPDF

set pdfFile to choose file of type "PDF " without invisibles
openPDF for pdfFile at 5 (* page number *)

*Edit: Just to confirm ‘officially’, this from page 39 of Developing for Adobe Reader (PDF):

Right… the goto page command is in the Acrobat Viewer Suite of Acrobat, not in reader. Thanks for the handy UI script.

You’re welcome. I inserted confirmation from Adobe into my last message (and ‘tweaked’ the script slightly). :wink:

thanks for your help !