RE: Quark Scripting
RE: Quark Scripting
- Subject: RE: Quark Scripting
- From: "Sprague, Graham" <email@hidden>
- Date: Mon, 4 Dec 2000 10:05:22 -0500
Thanks for your help. Although what you suggested did't work if I had items
with duplicate name on the page. Those duplicate items even when not
selected were getting changed. Notice that when changing the name I used
the uniqueID without it Quark changes every thing on the page whose names
match those in the selection. Using the uniqueID allows me to operate only
on the items I selected. See below...
tell document 1 of application "QuarkXPress(tm) 4.11"
tell page 1
set listID to uniqueID of every generic box whose selected is true
set dResult to display dialog "Enter Group Number:" default answer
""
if button returned of dResult is "OK" then
set groupNum to text returned of dResult
repeat with i from 1 to count of listID
set curID to item i of listID
set curName to (name of generic box id curID)
set lastChar to last character of curName
if curName contains "Copy" then
set (name of generic box id curID) to ("Copy
Box " & groupNum)
else
set (name of generic box id curID) to
("Image Box " & groupNum & lastChar)
end if
end repeat
end if
end tell
end tell
Thanks,
Graham Sprague
Advertising Systems Administrator
Staples, Inc.
508-253-8170
>
----------
>
From: Hans Haesler
>
Sent: Saturday, December 2, 2000 6:33 AM
>
To: AS lists
>
Cc: Sprague, Graham
>
Subject: RE: Quark Scripting
>
>
On Fri, 1 Dec 2000, Graham Sprague wrote:
>
>
>Is it possible to get the name of an item using the "uniqueID" property
>
of a
>
>generic box in QuarkXpress. Note I have set the names of the selected
>
boxes
>
>with another script before I ran this one. Each time I get an error that
>
>says can access the name of "202"(the uniqueID for the item)
>
>
Graham,
>
>
the next time, please, start a new thread (your message trails all
>
12 messages of applescript-users digest, Vol 2 #89).
>
>
Your script contains 'tell document 1'/'tell page 1' loops inside
>
of 'tell document 1'/'tell page 1' loops...
>
>
Here I've stripped out what you don't need. Note that you don't address
>
the box by repeating 'uniqueID'. Use just 'id':
>
---
>
tell document 1 of application "QuarkXPress 4.11"
>
tell page 1
>
set listID to uniqueID of every generic box whose selected is true
>
set dResult to display dialog "Enter Group Number:" default answer ""
>
if button returned of dResult is "OK" then
>
set groupNum to text returned of dResult
>
repeat with i from 1 to count of listID
>
set curID to item i of listID
>
set curName to (name of generic box id curID)
>
set lastChar to last character of curName
>
if curName contains "Copy" then
>
set (name of text box curName) to ("Copy Box " & groupNum)
>
else
>
set (name of picture box curName) to ("Image Box " & groupNum &
>
lastChar)
>
end if
>
end repeat
>
end if
>
end tell
>
end tell
>
---
>
>
You could use the box type instead of the not very reliable uniqueID:
>
---
>
tell document 1 of application "QuarkXPress 4.11"
>
tell page 1
>
set objRef to object reference of every generic box whose selected is
>
true
>
if class of objRef is not list then set objRef to {objRef}
>
set dResult to display dialog "Enter Group Number:" default answer ""
>
if button returned of dResult is "OK" then
>
set groupNum to text returned of dResult
>
repeat with aBox in objRef
>
tell aBox
>
set boxType to box type as text
>
set curName to name
>
set lastChar to last character of curName
>
if boxType = "TXTx" then
>
set name to ("Copy Box " & groupNum)
>
else if boxType = "PICx" then
>
set name to ("Image Box " & groupNum & lastChar)
>
end if
>
end tell
>
end repeat
>
end if
>
end tell
>
end tell
>
---
>
>
HTH,
>
>
Hans
>
>
---
>
Hans Haesler | email@hidden