How to merge XPress files with AppleScript ?

Hello,

I am begining with Applescript, and, as you can imagine, I have some problems I had not expected :slight_smile:

My script generates different pages of a document separately : I mean, each couple of page is writed in a different qsd file. At the end of the script, I want to merge all these file into one. Do you know a way to do it ?

I have another little problem : while executing the script, I put a picture into a picture box. But later I need to delete this picture keeping the picture box safe, but I don’t manage to do it. So if you have some ideas it would be greatly appreciated =)

Thanks by advance,
KorKi

note: please forgive my english :stuck_out_tongue:

This should give you a few pointers in removing pictures from boxes. Not sure that you can do the join documents IMO it would be better have your script just make the one file.

tell application "QuarkXPress"
	activate
	try
		-- This section will ensure that a document is open, before proceeding 
		if (exists document 1) is false then error "No document is open."
		tell document 1
			-- This 'try' will make a list of the selected picture boxes, and ensure that at least 1 box is selected 
			try
				set tool mode to contents mode
				set Pict_Box_List to the uniqueID of every picture box whose selected is true
				if (length of Pict_Box_List) < 1 then error
			on error
				error "At least one picture box must be selected."
			end try
			repeat with i from 1 to length of Pict_Box_List
				tell picture box id (item i of Pict_Box_List)
					if file path of image 1 is not null then
						try
							delete image 1
						end try
					end if
				end tell
			end repeat
			beep 2
		end tell
	on error errmsg number errnum
		if errnum is not equal to -128 then
			beep
			display dialog errmsg & " [" & errnum & "]" buttons {"OK"} default button 1 with icon stop
		end if
		return
	end try
end tell