I’m getting the following error while running my script:

→ InDesign 2.0.2 got an error: File some object wasn’t found.

The script runs fine on my machine, but not on one of my user’s machines. Does anyone know what this error means or have advice on how to trap the error? Thanks.

Here is the code:

set myFolder to choose folder with prompt "Select folder containing InDesign Documents"
set myFileList to {}
tell application "Finder"
	set myFiles to files of myFolder
	repeat with myFileCounter from 1 to (count myFiles)
		if file type of item myFileCounter of myFiles is "InDd" then
			copy (item myFileCounter of myFiles) as string to end of myFileList
		end if
	end repeat
end tell

if (count myFileList) > 0 then
	set myPDFFolder to choose folder name with prompt "Save PDF files to:"
	--This is where the PDF logic goes
	repeat with thisItem in myFileList
		tell application "InDesign 2.0"
			open thisItem
			set thisItem to active document
			tell active document
				--attempt to export to PDF using user defined setting
				set PDFname to myPDFFolder & the name of thisItem & ".pdf" as string
					export format PDF type to PDFname using PDF export style "test" without showing options
				end try
			end tell
			close active document
		end tell
	end repeat
	display dialog "No InDesign files were found in the selected folder."
end if

Just a guess since I don’t have InDesign…

Is it possible that you need to change this:

tell application "InDesign 2.0" 
          open thisItem

To this:

tell application "InDesign 2.0" 
          open file thisItem