open and close files of a folder indesign

Hi All,

See my code below, I am trying to open, print and close without saving the file from a folder. But my problem is that I am not able to open the files.

Please correct me.


set destFolder to choose folder with prompt "Please choose folder containing indesign files"
set tarFolder to choose folder with prompt "Please choose target folder"
copy (list folder (destFolder) without invisibles) to fileList

tell application "Adobe InDesign CS3"

repeat with i from 1 to count of fileList
open file i
print
close saving no
end tell

Thanks
Pooja

Hi Pooja,

list folder returns only the names, but you need the paths.
Try this

set destFolder to choose folder with prompt "Please choose folder containing indesign files"
set tarFolder to choose folder with prompt "Please choose target folder"
try
	tell application "Finder" to set fileList to files of destFolder as alias list
on error
	tell application "Finder" to set fileList to files of destFolder as alias
end try
tell application "Adobe InDesign CS3"
	repeat with oneFile in fileList
		open oneFile
		print
		close saving no
	end repeat
end tell

Edit: Alternatively without the Finder


set destFolder to choose folder with prompt "Please choose folder containing indesign files"
set tarFolder to choose folder with prompt "Please choose target folder"
set fileList to list folder destFolder without invisibles
tell application "Adobe InDesign CS3"
	repeat with oneFile in fileList
		open (destFolder as Unicode text) & oneFile
		print
		close saving no
	end repeat
end tell