Hi!
I’ve written dozens of scripts for Quark but I’ve never had to group or ungroup graphic or line box objects till now. The dictionary shows the "Group Box " class but I haven’t been able to figure out the syntax. Is there a snippet or two around that anyone would like to share?
Thanks,
Volker Arnold
Pre-Press Technical Artist
Pollard Banknote Ltd.
varnold@pbl.ca
[/u]
I dont think that you can do this with Quark, though the xtension Scriptmaster XT gives you this ability if I remember correctly. It has been a few years since I have used it, but if you do a lot of scripting it is a valuable tool.
tell application "QuarkXPress™ 4.11"
tell document 1
set tool mode to drag mode
set selected of picture box 1 to true
set selected of text box 1 to true
end tell
activate
select menu item 10 of menu 5
end tell
Before you run the script you need to make sure you have a document open with at least one picture box and one text box.
The placement of the ‘activate’ statement is very important - it’s a workaround for a bug. If you ‘activate’ too early, the menu item selection won’t work!
You should find that your two boxes are grouped successfully after running the script
Also note that the menu and menu item are selected by ID. You can use the actual names, such as ‘Group’ and ‘Item’ but there are a few bugs (errors?) with naming of certain menu items. I can’t remember which ones exactly but some of them use three "."s instead of an ellipsis. I’d stick with using IDs - but be aware of the fact that dividers count as a menu item.
Hopefully this should get you going. As you seem to have knowledge of XPress scripting, you should find it easy to select the correct items in your document.
Thanks for your quick response. Your solution works great in Quark 4.1. However, we’ve migrated to Quark 5.01 and the same code doesn’t even compile until you actually use the menu item name instead of the index number. If you have a copy of Quark 5, and bit of time, throw a couple of pic boxes on a blank doc and try running the following code:
tell application "QuarkXPress™"
tell document 1
set tool mode to drag mode
select (generic boxes 1 thru 2)
end tell
activate
select (menu item "Group") of menu "Item"
end tell
It selects the 2 picture boxes just fine, but only briefly flashes a grouped box, disappears, then just shows the 2 selected boxes. The weird thing is, the “Item” menu showed the “Ungroup” menu item as enabled and the “Group” as disabled. Yet there was no containing “Grouped Box”…hmmm.
The application I’m writing generates different kinds of register marks and different layouts. I thought it would help the operators to group the marks into sets, but this isn’t a necessary feature. You’d think something this basic would get a little more support from the mayor of “Quarkville”.
Unfortunately (or fortunately!?) I’m still on v4.11 so I’m not able to test the script under v5 at the moment.
I have a demo version of 5 at home which I use for script testing but I won’t be there for about 12 hours!
Have you tried positioning the ‘activate’ command after the application tell statement? It could be that the bug that existed in v4.11 has been squashed but has reappeared in a different way… Just a thought…
Failing that, you could always post on the Quark AppleScript forum where there are many talented scripters who constantly offer extremely good advice.
I’ll give it a bit more thought throughout the day and if I come up with anything, I’ll post back here!