Indesign CS2 export PDF preferences: all pages

I am struggling trying to export as PDF all pages in an Indesign CS2 document. Any guidance would be greatly appreciated!

My export as pdf script works fine if I export single pages. For some reason trying to explicitly tell it to export all pages causes it to fail. The script fragment is:


tell application "Indesign CS2"
   ...
   tell PDF export preferences
       set page range to all pages
   end tell
   ...

end tell

Indesign export PDF error -10006. Adobe InDesign CS2 got an error: Can’t set page range of PDF export preferences of document “Untitled-10” to all pages.

fotocodex:

Not having ID here this is only logical theorizing… A page range has a beginning and an ending. All Pages does not. So set your page range to pages 1 through (count pages of active document) .

Just a theory.
Jim Neumann
BLUEFROG

Thank you. That pointed me in the right direction.

To answer my post: it became painfully obvious once I remembered to just look at the Indesign scripting reference!

	
tell application "Adobe InDesign CS2"
		tell PDF export preferences
			--page range can be either all pages or a page range string 
			--(just as you would enter it in the Print or Export PDF dialog box). 
			set page range to "1-" & (count pages in myDocument) as string
		end tell
	end tell