Acrobat 7 Pro 'Save As' query...

Hi There,

Over the past week I’ve been writing a script to batch process some files in Acrobat 7 Pro using UI scripting and I’ve come across a slight problem.

To cut a long story short my query is, in the simple version of the ‘Save As’ dialog box, beneath the filename input box, there’s a drop down list entitled ‘where:’. This dropdown allows you the specify a recent location or folder in which to save the file.

Does anyone know where the information for this dropdown is stored and can I write to it? This would allow me to specify a location.

If I open a file manually, from the folder containing the files to be processed, and resave it back to the same location Acrobat remembers that location and presets that location in the ‘where:’ dropdown when the batch process is run. This has lead me to think that Acrobat must be saving that location somewhere, but where and can I write to it?

Thanks in advance,

Nick

Hi Nick,

Acrobat is quite well scriptable, why do you use GUI scripting?

A trick to specify the location in open/save dialogs is the shortcut shift-cmd-g and then type in the (POSIX) path

Hi Stefan,

Thanks for the reply and for the solution.
I’m using UI scripting because it’s an something I can’t do with applescript or javascript.

Thanks again for the help,

Nick

Having dug a little deeper on this one I found the path is stored in the plist “com.adobe.Acrobat.Pro.plist”.
I’ve been trying to read/write values to:-

AppleNavServices:PutFile:0:HomeDirectoryPath
and
AppleNavServices:PutFile:0:Path

however I’m getting the error ‘The domain/ default pair of …’, having read a few other posts on reading/ writing to plists I’m a little unsure why my code is failing, obviously I guess it’s my syntax. Please can someone point me in the right direction.

Thanks in advance,

Nick

Nick, what are your requirements from the save as dialog? can you not use EPS conversions?

property Default_Location : (path to desktop as Unicode text)
--
tell application "Adobe Acrobat 7.0 Pr#2CB915"
	activate
	set Doc_Name to name of document 1
	set Base_Name to my getBaseName(Doc_Name)
	set New_File_Path to Default_Location & Base_Name & ".rtf"
	save front document to file New_File_Path using conversion "com.adobe.acrobat.rtf"
	close front document
end tell
--
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName

other conversions are {“com.adobe.acrobat.eps”,“com.adobe.acrobat.html-3-20”,“com.adobe.acrobat.html-4-01-css-1-00”,“com.adobe.acrobat.jpeg”,“com.adobe.acrobat.jp2k”,“com.adobe.acrobat.doc”, “com.adobe.acrobat.png”, “com.adobe.acrobat.ps”, “com.adobe.acrobat.accesstext”,“com.adobe.acrobat.plain-text”, “com.adobe.acrobat.tiff”, “com.adobe.acrobat.xml-1-00”}

I don’t think you can influence the local preferences for Acrobat’s Convert from PDF

Hi Nick,
not sure if this will help but this is how I save to EPS format using Acrobat 7:

set dest_path to path to desktop as string
set filename to "myAcrobatFile"

tell application "Adobe Acrobat 7.0 Professional"
	save document 1 to file (dest_path & epsfilename) using EPS Conversion
	close active doc
end tell

Hi Mark,
Thanks for the reply and for the code. I’d that before in one of your other posts and it was a big help.

With this query it’s the default location I’m trying to set not the method of conversion.
If I open a file and resave it to a new location I can see that change in the plist file. What I’d like to do is write a new default location to the plist file so when the ‘Save As’ dialog is encountered it is already pointing at the new location rather than having to navigate to it. In my previous post I was trying to find out why I’m getting an error when I try to read/ write to the com.adobe.Acrobat.Pro.plist file.

Thanks again for the help.

Regards,

Nick

I have the plist open but it’s very slow to respond will get back in a bit if I can find anything.

Hi Mark,

Thanks again for your help. When trying one or two things I found that the two values below, in the plist file, changed when I selected a new location:-

AppleNavServices:PutFile:0:HomeDirectoryPath
and
AppleNavServices:PutFile:0:Path

It’s the writing of a new value to both of these I’m having problems with.

Regards,

Nick

My machine is not liking opening this file this morning “the spinning ball” every time I try touch it.

Nick, I guess you wrote the path in the shell script with the .plist extension. Omit it!

do shell script "defaults read com.adobe.Acrobat.Pro AppleNavServices:GetFile:0:Path"

Hi Stefan,

Thanks for your reply and for the code.
The ‘plist’ extension wasn’t there, I think it was something to do with the way I was constructing the statement. I’d been working with this post that I’d found:-

http://bbs.applescript.net/viewtopic.php?pid=78853

Your code works fine and gives me the value required. Please can you show me how I would write a value so I can apply this to the code I’ve been working with. I’d like to know where I’ve gone wrong for future reference.

Thanks again Stefan.

Regards,

Nick

the syntax is

defaults write [domain] [key] [value]

for example

tell application "System Events" to set thefileURL to URL of (path to desktop)
do shell script "defaults write com.adobe.Acrobat.Pro AppleNavServices:GetFile:0:Path " & quoted form of thefileURL

Be careful to use the right file URL syntax

Thanks for the reply Stefan and for the code. :slight_smile:
I’ll have a look and see why my code was failing.

Thanks again for your time, it’s much appreciated.

Regards,

Nick