It has been a looong time since I’ve scripted QXP 3 so the language may be a little different than what I’ve done here. I wasn’t sure if you meant that you want to add the 10 mm boxes above and below the page or above a picture box so I went with a picture box.
tell application "QuarkXPress™"
set horizontal measure of document 1 to millimeters
set vertical measure of document 1 to millimeters
tell document 1
set pWidth to page width as real
set pHeight to page height as real
tell page 1
set {x1, y1, x2, y2} to bounds of picture box 1 as list
set {x1, y1, x2, y2} to {x1 as real, y1 as real, x2 as real, y2 as real}
make new picture box at beginning with properties {bounds:{x1 - 10, y1, x1, y2}}
set suppress printing of picture box 1 to true
make new picture box at beginning with properties {bounds:{x2, y1, x2 + 10, y2}}
set suppress printing of picture box 1 to true
end tell
end tell
end tell
Since the “suppress printing” property has been set to “true” the newly created boxes will not appear on the EPS file. If you need to actually delete them, you will have to give each of the boxes a name, then have your script delete the objects by name.
For the colors, you will have to delete all the colors you don’t want to appear but you cannot delete White, Black, Registration, Cyan, Magenta or Yellow.
For exporting the EPS file, I am assuming you are using the “save to eps file” command. To do this, you will need to pass a full path to the command. Here is how to save the EPS file in the same folder with the original document:
tell application "QuarkXPress™"
set fPath to file path of document 1 as string --make sure you specify "string". The default is an alias and won't work
set fName to name of document 1
set AppleScript's text item delimiters to ":"
set fPath to every text item of fPath as list
set fPath to items 1 thru ((count items of fPath) - 1) of fPath as string
set AppleScript's text item delimiters to ""
set fPath to fPath & ":" & fName & ".eps" as string
save page 1 of document 1 in file fPath EPS format Mac color EPS data binary EPS OPI include images with include preview
end tell
Keep in mind that if the QXP document has not been previously saved, the file path will be returned as null so you’ll have to save the QXP document first.
A great way to figure out the language for referring to objects with AppleScript is to have AppleScript return the properties of the object in question. Here is an example with QuarkXPress
tell app "QuarkXPress"
return properties of document 1
end tell
From the record that is returned from this code you will be able to see how QuarkXPress expects you to refer to objects and what properties belong to this object. In the code above we used the “file path” property of the original document. We then trimmed off the file name so that we were left with the enclosing folder. Be sure to specify that the file path is returned as a string since the default return will be an alias.
Good luck. I’ll continue to check this post in case you have any more questions. Also, check the “unScripted” section of this site as I plan to do an article in the coming weeks on very practical coding and trouble-shooting techniques.
Hope this helps.
Scott Lewis