Ka Boom (script crashes QXP; whatdoIdo now?)

The script below crashes QXP. (Its supposed to loop thourgh a document backwards, cut everything on each page, then paste those iitems back where they were)

It seems to get hung up on the “paste” part of the script. I usually get a “Connection not valid” message after Quark bites it.


tell application "QuarkXPress"
	tell front document
		-- Set up the units
		set vertical measure to picas
		set horizontal measure to picas
		set item spread coords to true
		-- Count the pages in the document
		set pageCount to count pages
	end tell
	-- Loop through the pages in the document
	repeat with P from pageCount to 1 by -1
		-- Deselect anything that may be selected
		set selection to null
		--Select everything on the current page		
		tell front document
			show page P
			set selected of every generic box of page P to true
		end tell
		-- Duplicate the selection
		set PageContents to selection
		tell application "QuarkXPress" to select menu item "Paste in place" of menu "Edit"
		delay 3
	end repeat
end tell

Model: Powerbook G4 1Ghz
AppleScript: 1.9.3
Browser: Firefox 1.5
Operating System: Mac OS X (10.3.9)

I’m guessing that you are running Quark 5 or 6, which I have not scripted and barely used. However you might check to see if you have any text boxes that are liked to another spread, this might be causing a problem with your cut command if I remember correctly.

Yeah, that’s why the script goes to the back of the document.

Is there a way to code the “cut” differently? All I really want to do is break the links of any text chains, WITHOUT affecting the contents of the boxes in those chains.

And yeah, it’s QuarkXPress 6.5.