Export PDF to RTF or Word

Hello,
I am trying to find a way to open a bunch of PDF files and export to word or RTF from the file menu in Acrobat 8 and then have the text files save is a specific folder.
The only script I found so far was using a program called SLIM. But I want to do this through straight applescripting.
Is that possible.
I was very close using automate in Leopard, except I couldn’t get the PDF 's to close once they were done.
any help is appreciated.
thanks
babs

Barbara, you could give something like this a try:

property Default_Location : (path to desktop as Unicode text) as alias
--
set Input_Folder to choose folder default location Default_Location with prompt "Select a folder of PDFs" without invisibles
--
tell application "Finder"
	set File_List to (files of Input_Folder whose name extension is "pdf")
	repeat with This_File in File_List
		set The_File to This_File as alias
		tell application "Adobe Acrobat 7.0 Professional"
			activate
			open The_File
			set Doc_Name to name of document 1
			set Base_Name to my getBaseName(Doc_Name)
			set New_File_Path to (Default_Location as string) & Base_Name & ".rtf"
			save front document to file New_File_Path using conversion "com.adobe.acrobat.rtf"
			close front document
		end tell
	end repeat
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

The above is for RTF (there are no options available you from script Acrobat V7) set these in your prefs before running.

For MWD change the name extension at the end of New_File_Path to “.doc” & the conversion type to “com.adobe.acrobat.doc”

For Plain Text ditto the above with “.txt” & “com.adobe.acrobat.plain-text”

Hello Mark,
I will try this once back in my office this morning.
I will let you know how I make out.
I was doing it locally through Acrobats built in batch feature, but I wanted something in an applescript instead if possible.
thanks so much…
babs

Hi Mark,
It worked…
the only thing is if I do a batch I would rather have them go into a folder I make on my desktop rather than loose …my desktop is already a mess :wink:
I made a folder on my desktop called “PDF to RTF”, and tried something like this to get it to compile, but it won’t.

property Default_Location : (path to  target of Finder window 1 to folder "PDF to RTF" of folder "Desktop" of folder "barbarapress" of folder "Users" of startup disk
 as Unicode text) as alias

Do you know how I could get this part to work?

thanks

The I would change the Finder part of the script to look for an output folder name else make one like this:

property Default_Location : (path to desktop as Unicode text) as alias
--
set Input_Folder to choose folder default location Default_Location with prompt "Select a folder of PDFs" without invisibles
--
tell application "Finder"
	-- Check to see if your folder is on the desktop else make one
	if not (exists (folder "PDF to RTF" of Default_Location)) then
		make new folder at Default_Location with properties {name:"PDF to RTF"}
	end if
	set Output_Folder to (folder "PDF to RTF" of Default_Location) as text
	--
	set File_List to (files of Input_Folder whose name extension is "pdf")
	repeat with This_File in File_List
		set The_File to This_File as alias
		tell application "Adobe Acrobat 7.0 Professional"
			activate
			open The_File
			set Doc_Name to name of document 1
			set Base_Name to my getBaseName(Doc_Name)
			set New_File_Path to Output_Folder & Base_Name & ".rtf"
			save front document to file New_File_Path using conversion "com.adobe.acrobat.rtf"
			close front document
		end tell
	end repeat
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

Hi Mark!
perfect :wink:
BTW-what does the “without invisibles mean” ““Select a folder of PDFs” without invisibles”
in this line?
trying to learn :wink:
thanks!!
barbara

In that line of the code its using terms from Standard additions the without invisibles stops files whose name starts with “.” such as the systems DS_Store files showing in the dialog. I think that I have NOT used it correctly here. It could be for use with “choose file” and NOT needed with “choose folder”

Just checked and it does apply to both but the invisibles default is true with choose file and false with choose folder so not needed