how to delete master pages in Quark 6?

I’m trying to delete a master page in Quark, using this code:

tell application “QuarkXPress”
activate
delete spread 2 of master document 1
end tell

It just errors out, with this message:

QuarkXPress got an error: spread 2 of master document 1 doesn’t understand the delete message.

I had this working yesterday, maybe with different code, but i set it aside without saving changes when i went to do somethig else. Anyone know what syntax to use for deleting a spread?

you can only delete master pages not spreads, so find the page of spread

tell application "QuarkXPress"
    activate
    tell master document 1
        delete page 1
        --or
        delete (every page whose name contains "A-Master A")
    end tell
end tell

The funny thing is that you can tell it to delete page 3 and it deletes page 5. There something strange about how it refers to pages from names

HAVE FUN

Bevan www.applescript.co.nz

Just let you know, when you delete the page is the spread number not the page number. So spread 2 delete page 2. You can’t go pages contain name “A - Master A” as it get the non spread page number and delete the wrong page. Even if you tell spread delete page 1 and 2 it also get the non spread page number and deletes the wrong page.

When you delete a page it deletes the spread (2 pages)

Best way is, delete in reverse order

tell application "QuarkXPress"
	activate
	tell master document 1
		show
		set MastersAvailable to name of every spread
		set ToDelete to {"A-Master A", "C-Master C"}
		repeat with i from (count of MastersAvailable) to 1 by -1
			if ToDelete contains name of spread i then
				delete page i
			end if
		end repeat
	end tell
end tell

Have fun

Bevan www.applescript.co.nz