Indesign CS3 and PDFs script

Below is a script I’ve used in the past and just tried to run on a new computer… I got nothing as a result. It created the folders but never built the pdfs. I want to combine this with a find/replace script to do a bunch of changes to about 50 documents. I know I’ve used this before… why isn’t it working?

--http://bbs.applescript.net/viewtopic.php?p=31433 
property done_foldername : "PDFs"
property originals_foldername : "Completed Files"
--on open theFiles
on open sourceFolders
	repeat with sourceFolder in sourceFolders
		--set sourceFolder to fullname of theFiles as Unicode text
		--repeat with aFile in sourceFolders
		tell application "Finder"
			try
				-- If you would like to include subfolders, you say - every file of entire contents of folder 
				set idFiles to (every file of folder sourceFolder whose file type is "IDd3") as alias list
			on error -- work around bug if there is only one file 
				set idFiles to (every file of folder sourceFolder whose file type is "IDd3") as alias as list
			end try
		end tell
		tell application "Finder"
			if not (exists folder done_foldername of sourceFolder) then
				make new folder at sourceFolder with properties {name:done_foldername}
			end if
			set the results_folder to (folder done_foldername of sourceFolder) as alias
			if not (exists folder originals_foldername of sourceFolder) then
				make new folder at sourceFolder with properties {name:originals_foldername}
				set current view of container window of sourceFolder to list view
			end if
			set the originals_folder to folder originals_foldername of sourceFolder
		end tell
		
		if idFiles is not {} then
			tell application "Adobe InDesign CS3"
				set user interaction level to never interact
				repeat with i from 1 to count of idFiles
					open item i of idFiles
					tell document 1
						
						--LABEL FILES
						set docName to full name as Unicode text -- name includes .indd should remove at some point 
						set clipPoint to offset of ".indd" in docName
						set trimmedName to (characters 1 thru (clipPoint - 1) of docName) as string
						--ACTIONS
						with timeout of 1800 seconds -- 30 minutes
							export format PDF type to trimmedName & "_press" & ".pdf" using "[Press Quality]" without showing options
						end timeout
						close without saving
					end tell
				end repeat
				set user interaction level to interact with all
			end tell
		end if
		return 10 -- try again in 10 seconds 
	end repeat
end open

Moved the topic from the Code Exchange to the OS X forum, as this seems to be a question, not a working script :wink:

The first question I would have is what are the differences between the two computers? Are they running the same versions of the OS and InDesign? If it is a different OS the first step would be to recompile on the new computer and try to run it again. If it is a different version of ID then there might have been changes to the scripting commands that need to be addressed.

A quick look at the InDesign portion isolated on my system running 10.5.8 in ID CS3 I ran into two problems, so I’m guessing that you used this script in CS2 or earlier before. Below is the results of my edits that work on my computer with the repeat loop and open command commented out. The errors I cam across are:

  1. user interaction level is part of the script preferences, and you need to change the property there.
  2. close without saving changes to close saving no
tell application "Adobe InDesign CS3"
	activate
	set user interaction level of script preferences to never interact --(never interact/interact with all/interact with alerts) 
	--repeat with i from 1 to count of idFiles
	--open item i of idFiles
	tell document 1
		
		--LABEL FILES
		set docName to full name as Unicode text -- name includes .indd should remove at some point 
		set clipPoint to offset of ".indd" in docName
		set trimmedName to (characters 1 thru (clipPoint - 1) of docName) as string
		--ACTIONS
		with timeout of 1800 seconds -- 30 minutes
			export format PDF type to trimmedName & "_press" & ".pdf" using "[Press Quality]" without showing options
		end timeout
		close saving no --close without saving
	end tell
	--end repeat
	set user interaction level of script preferences to interact with all --(never interact/interact with all/interact with alerts) 
end tell

hmmm… but you removed all the elements that make it a drag and drop. To batch process files it should be that rather than something that runs within Indesign CS3

I took those out for testing purposes. Since you indicated that the finder routines were working I just dealt with the ID portion. Change those three lines in the original script and see if it works.