open quark documents

Hi,

The following code opens all quark documents in the chosen folder, but it doesn’t look for files in subfolders. How to achieve this?


tell application "Finder"
	activate
	set source_folder to choose folder with prompt "Select the source folder:"
	set source_files to (files of source_folder whose file type is "XDOC")
	set source_files to sort source_files by name
	try
		set source_files to (sort source_files by name) as alias list
	on error
		set source_files to (sort source_files by name) as alias as list
	end try
end tell

tell application "QuarkXPress_4.11"
	activate
	set the t_file to item 1 of source_files
	open the t_file
	close document 1
end tell

TIA, Bart 8)

You will have to modify this script but this is my way to look in subfolders with applescript
maybe this can help you

property kindOfFolders : {"map", "Map", "Folder", "folder"}

property newFileList : {}
set newFileList to {}
property typeOfFile : "XPRJ"-- Quarkxpress 6 documents

set theFolder to choose folder with prompt "Select the folder where te Quark files in" without multiple selections allowed
set theFileList to checkFolder(theFolder)

-- put your script here to open the quark documents

(*_________HANDLER________*)
on checkFolder(theFolder)
	try
		tell application "Finder"
			set theFileList to name of items in theFolder
		end tell
		
		repeat with theFileName in theFileList
			set theFile to ((theFolder & ":" & theFileName) as string) as alias
			set myInfo to info for theFile
			if file type of myInfo is equal to typeOfFile then
				set newFileList to newFileList & theFile
				
			else if kind of myInfo is in kindOfFolders then
				set newFileList to checkFolder(theFile)
			end if
		end repeat
	end try
	return newFileList
end checkFolder

good luck

greetings bastiaan

thnx dj bassie, your script looks promising, will take a look at it…bedankt 8)

i finally got it to work by adding these lines:


repeat with i from 1 to length of source_files
set the t_file to item i of source_files
open the t_file

so in total it looks like this:


tell application "Finder"
	activate
	set source_folder to choose folder with prompt "Select the source folder:"
	set source_files to (files of entire contents of source_folder whose file type is "XDOC")
	set source_files to sort source_files by name
	try
		set source_files to (sort source_files by name) as alias list
	on error
		set source_files to (sort source_files by name) as alias as list
	end try
end tell

tell application "QuarkXPress_4.11"
	activate
	repeat with i from 1 to length of source_files
		set the t_file to item i of source_files
		open the t_file
    ------
   close document 1 saving yes
	end repeat
end tell

on to the next question, but will ask it in a new post…Grtz 8)