I work for a newspaper and just recently they have reduced the size of the paper so that every page has to be grouped and moved to +1p9.6 for even pages and -1p9.6 for odd. I need a script that will operate on OSX but control a QuarkXpress 4.1 page in classic. Perhaps a couple of buttons one for even - one for odd. Thought it would be easy, yet has turned out a brick wall for my scripting ability.
I think that you have to build it as a Classic application and run in the Classic environment to script Quark 4.1 properly. A quick test shows that the OS 9 version of Smile writes script applications that run under Classic, and I think there was a version of script editor that allowed you to save as Classic or OS X applications.
Iām trying to work out a solution to your need. Just to keep things simpler as possible, do you have one or more pages in a single document? Are they set as single or spreads?
The files that are supplied to me from the editing crew are single. However, I built the classified section and they are multiple docs. (Yes I know I could just change to way I build it template wise, but it takes an act of God in this place, know what I mean - bet you do.)
We print in singles mostly no spreads.
Just a cap on this post to say I thoroughly appreciate your help! Applescript seems so UNcut and dried some days.
JEROME thanks for the email. I will try your app tonight. Cheers.
I worked out this. Iām sure that more skilled scripters can fine tune it (ditto making it work with picas ā ah! the good old days of genuine typographic measurement systems!) and make it more helpful for your job.
In my experience, I havenāt got troubles in running a script that addresses commands to a Classic application (eg. a FileMaker solution bound under Os9). Iām aware that Xpress is a hard-hardling beast.
Now, Iām leaving to push my publisher to change the paper format of our magazine to take advantage out of the script.
Have fun.
(*
theBounds = bounds of grouped objects to shift
BoundX = value of X position of the group
BoundL = value of lenght of the group
In this version the script works with one-spread documents.
Values expressed in millimeters.
I tried to turn instructions for evens and odds into handlers,
making the script shorter, but something seemed to go wrong with some variables.
So, longer but safer.
*)
tell application "QuarkXPress 4.1"
activate
-- choose the page to be handled
display dialog "Shift objects 1mm apart in an" buttons {"Cancel", "Even page", "Odd page"}
set EvenOrOdd to button returned of result
tell document 1
-- deselect all first to avoid problems running more than one time with the same document
set selected of every generic box to false
tell spread 1 -- notice that in this version, the script works only with one-spread documents
-- handle the even page
if EvenOrOdd = "Even page" then
tell page 1
-- select all
repeat with i from 1 to count of every generic box of it
tell generic box i
set selected of it to true
end tell
end repeat
-- selected objects are now automatically part of group box 1, so...
tell group box 1
set theBounds to bounds as list
-- shifts the group to its right by increasing values
-- increase X position, first...
set BoundX to item 2 of theBounds as number
set BoundX to BoundX + 1
set BoundX to BoundX & " mm" as string
set item 2 of theBounds to BoundX
-- ...then lenght
set BoundL to item 4 of theBounds as number
set BoundL to BoundL + 1
set BoundL to BoundL & " mm" as string
set item 4 of theBounds to BoundL
-- group shifts to its right
set bounds to theBounds
set selected to false
end tell -- group box
end tell -- page
end if -- evens
-- handle the odd page
if EvenOrOdd = "Odd page" then
tell page 2
repeat with i from 1 to count of every generic box of it
tell generic box i
set selected of it to true
end tell
end repeat
tell group box 1
set theBounds to bounds as list
set BoundX to item 2 of theBounds as number
set BoundX to BoundX - 1
set BoundX to BoundX & " mm" as string
set item 2 of theBounds to BoundX
set BoundL to item 4 of theBounds as number
set BoundL to BoundL - 1
set BoundL to BoundL & " mm" as string
set item 4 of theBounds to BoundL
set bounds to theBounds
set selected to false
end tell -- group box
end tell -- page
end if -- odds
end tell -- spread
end tell -- document
end tell -- application
hmbeyle, nice solution and one that I think that most people would come up with.
Now Iāve had time to comment the script. The one I was originally doing was changing the page size as well as moving guides, reseting margins, and adjusting the page items, and commenting the page with style sheet names. Dropped it due to a switch to InDesign. Now I donāt even have Classic running at home which is where I do most of my scripting, so I havenāt played around with it in about a year.
This script should handle single or multiple page documents and tests for odd or even pages, so no need for users input is needed. If you are manually changing the page size you could add that in by uncommenting the lines noted in the script.
on is_odd(this_number)
--This handler tests if the (page) number is odd or even
if this_number mod 2 is not 0 then
return true
else
return false
end if
end is_odd
tell application "QuarkXPressĆ¢āĀ¢ 4.11"
activate
tell document 1
--stores the horizontal and vertical measures set in the document
set OldH to horizontal measure
set OldV to vertical measure
--resets to measures to points for ease of math
set horizontal measure to points
set vertical measure to points
set page rule origin to {0, 0}
--uncomment the next two lines and add in the correct point measure for the new document size if you want to do this automatically
--set page width to "792.0 pt"
--set page height to "1224.0 pt"
--ensures the tool mode is correct
set tool mode to drag mode
repeat with i from 1 to (count of pages)
--deselects everything
set selection to null
--selects everthing on the page, no need to group them
set selected of every generic box of page i to true
--working only with the origin of bounds is simpler to deal with for a move
set theBounds to origin of bounds of selection as list
set x to name of page i as real --page name which is the same as the auto page number.
tell me
set x to is_odd(x)
end tell
if x is true then
set origin of bounds of selection to {item 1 of theBounds, (item 2 of theBounds as real) - 21.6}
else
set origin of bounds of selection to {item 1 of theBounds, (item 2 of theBounds as real) + 21.6}
end if
end repeat
--resets the measures to whatever was set when the script was run
set horizontal measure to OldH
set vertical measure to OldV
end tell
end tell
āOrigin of bounds of selectionā and storing data as ārealā widened my horizons in scripting QuarkXpress:
while solving jeffmarkās problem in a thougher way than mine, you gave me the key I was looking for to move text overflows around layouts.
Outstanding performance my friends. I was running into QuarkXpress data conversion errors over and over until I used the classic editor to compile and build the application, and they started to do what theyāre supposed to. This is going to save a bunch of time and error.
The script works in that it moves all the items, however for some wierd reason it makes each item a little bigger then the original.
I havenāt figured it out - other then when OSX loads classic it insists upon updating the applescript extension to 1.8.3. Canāt try the old software if I wanted to. It just writes over it. Bully. I canāt boot to OS9 due to admin rights. #%#&*@ privledges!!! :mad:
Another way to complete this task would be to execute menu items to select all - then group all - then move to my desired increment.