Set initial view mode in Acrobat document

Hi there

I have this script:

tell application "Adobe Acrobat Pro"
	set view mode of active doc to "pages and bookmarks"
end tell

However, it does not work! I know that the quoted text is right as doing get view mode of active doc returns “pages and bookmarks”

Any suggestions? I am trying to set the initial view mode of a PDF.

Thanks

I’m sorry, it’s not right.
pages and bookmarks is a (enumerated) constant, see pvew enumeration in the dictionary


tell application "Adobe Acrobat Pro"
	set view mode of active doc to pages and bookmarks
end tell

Thanks Stefan

But I am trying to set the document properties. So that the initial view when the document is later opened is “pages and bookmarks”

Your script changes the view all right but does not change the document properties.

Sorry, I was probably explaining myself badly

Is there a way to simply set the document properties so that the document will open later in pages and document view?

Cheers

Try checking “Restore last view settings when reopening documents” in Preferences and then running Stefan’s script.

Thanks. Not a solution I am afraid. I want to send the PDF to someone else, and have it open showing the bookmarks. So needs to be set in the properties of the document. There is a setting for this, under file properties, but the question is how to I set it for an individual document using applescript.

Cheers

Did you issue a save after it?

There is nothing to save the document remains unmodified. This is just a method to can call on at run time it’s not setting any document properties that can be saved and passed on to other PDF viewers.

view mode is a document property.

Have you tested the modified property? and can you close the document without a save prompt? Does it open again in this state?

No, it’s not working, like much of Acrobat scripting. But view mode is a document property, so if it doesn’t work, it’s not because it’s a property of the application.

Shane, if it’s broken then it has always TMK been that way. Acrobat’s AppleScript access stinks at best. and they do goof stuff up as well. That said I can’t find this in the JavaScript documentation either only had a quick look though.

Thanks for replies. Have been travelling, hence my belated response. I suppose one might try a gui solution if it is not possible to operate directly on the document properties using applescript. I will look at doing that, faute de mieux…

Just reverting on this thread with the solution I have adopted. In the end, I have got a GUI solution, which while not ideal, seems to work reliably on my MacBook with SSD. For other machines, you may need to play with the timing.

on setView()
	delay 1
	tell application "System Events"
		tell process "AdobeAcrobat"
			tell menu bar 1
				tell menu bar item "File"
					tell menu "File"
						tell menu item "Properties..."
							click
						end tell
					end tell
				end tell
			end tell
			tell item 1 of every tab group of window "Document Properties"
				click radio button "Initial View"
				tell group 1
					tell pop up button 1
						click
						tell menu 1
							click menu item "Bookmarks Panel and Page"
						end tell
					end tell
				end tell
			end tell
			click button "OK" of window "Document Properties"
		end tell
	end tell
end setView