I’ve tried one or two things that I’ve found on other posts but I still continue to get an error with this. Basically I’m trying to make a new page in QuarkXpress 6.52 from one of several master pages that exist.
If I execute the code below it creates a new page, from ‘A-Master A’, after the other pages:-
tell application "QuarkXPress"
activate
tell document 1
make new page at end
end tell
end tell
However, if I execute the code below I get an error:-
tell application "QuarkXPress"
activate
tell document 1
make new page at end with properties {master spread:"B-Master B"}
end tell
end tell
The error I get is ‘QuarkXpress got an error: Can’t get document 1.’ There are two master pages in the document ‘A-Master A’ and ‘B-Master B’.
What I’m trying to is generate new pages in a document with the master page being selected from variable data.
I have been trying to refer to the name of the master page i.e. ‘B-Master B’ rather than the index which is another thing I’ve tried.
I can’t remember where this snippet came from but it works for me. You may need to make object reference to apply the masters.
tell application "QuarkXPress"
activate
set master1 to object reference of spread 1 of master document 1
set master2 to object reference of spread 2 of master document 1
tell document 1
repeat with X from 1 to 2
set master spread of (make page at end) to master1
set master spread of (make page at end) to master2
end repeat
end tell
end tell
Thanks for your reply and for the code, it works a treat.
You’d just beaten me to it, I was just about to post this:-
set theNumber to 2
tell application "QuarkXPress"
activate
set theMaster to a reference to spread theNumber of master document 1
tell document 1
make new page at end with properties {master spread:theMaster}
end tell
end tell
Both versions do exactly what I want, out of curiosity though I tried playing around with a version that refers to the master page by name and not index. As yet though I’ve not got that working. I was trying the new approach so the code would look a little more readable and I could see straight away which master page was being used.