Quark XPress script problems

on pathName(fileAlias)
	copy fileAlias as string to xx
	copy text item delimiters of AppleScript to savedDelim
	set text item delimiters of AppleScript to {":"}
	set q to count of text items of xx
	set filePath to (text items 1 thru (q - 1) of xx as string) & ":"
	set fileName to last text item of xx as string
	set text item delimiters of AppleScript to savedDelim
end pathName


on open opy
	set opx to 1
	repeat number of items in opy times
		path to desktop from user domain
		set theHD to result as string
		
		
		tell application "QuarkXPress"
			activate
			open item opx of opy
			set docpath to file path of front document
			set fileName to name of front document
			my pathName(docpath)
			tell project 1
				set name of layout space 1 to fileName
			end tell
		end tell
		
		tell application "QuarkXPress"
			save document 1
			close document 1
		end tell
		
		set opx to opx + 1
	end repeat
	tell application "QuarkXPress"
		display dialog "Done" buttons {"OK"} default button 1 with icon 1
	end tell
end open

This is my first post here, so please be patient with me. I am fairly new to AppleScripting as well, with just a few fun and semi-functional scripts in my bag so far.

This script actually does work, but not in the manner I need it too. There are directories with mixed file types and I need to be able to drop a full directory on the AppleScript. Dropping the .qxd files directly works just fine. It will open all the files dropped on it, but when a folder is dropped, it will not process or close them. Is there a simple bit of code that I can paste in, or is a rewrite in order?

thanks,
Levon

Model: Dual 2.3GHz G5
AppleScript: 2.1.1
Browser: Firefox 2.0.0.4
Operating System: Mac OS X (10.4)
Quark XPress 6.5

sprale,

I revised your script… I changed some of your variables for my sanity and simplified it I also took out the stuff that wasn’t necessary. let me know if you have any questions


on open thefolder
	tell application "Finder"
		set theFiles to files of folder (thefolder as string)
	end tell
	
	
	set xDocs to {}
        ---- make a list of quark files
	repeat with afile in theFiles
		set {file type:FT, file creator:FC} to info for (afile as alias)
		if {FT, FC} is equal to {"XPRJ", "XPR3"} then copy afile to end of xDocs
	end repeat
	
	tell application "QuarkXPress"
		activate
		repeat with afile in xDocs
			
			open afile
			tell project 1
				set fileName to name
				set name of layout space 1 to fileName
				save
				close
			end tell
			
		end repeat
		display dialog "Done" buttons {"OK"} default button 1 with icon 1
	end tell
	
end open

mm

mcgrailm,
Thanks for your help. This helps me to see how to update the old library of scripts to retain functionality. I will test it out in a few days at work with the files I need to update. You are a lifesaver.

thanks,
Levon

Model: 450 G4/Dual 2.3 G5
Browser: Firefox 1.5.0.12
Operating System: Mac OS X (10.4)