Re: Scripting text box contents in QXP 4.11
Re: Scripting text box contents in QXP 4.11
- Subject: Re: Scripting text box contents in QXP 4.11
- From: Hans Haesler <email@hidden>
- Date: Wed, 13 Jun 2001 16:17:51 +0200
On Tue, 12 Jun 2001, Mark Bjaergager wrote:
>
My Quark returns an error, "Can't set story 1 of generic box 1 of spread 3
>
of document "homelib.qxp" of document 1 to "test"" and I can't figure out
>
why...
Hello Mark,
it is not a good idea to get 'boxList' directly 'as list'. If there are
several boxes then you'll get a list -- regardless if you ask for a list
or not. But if there is only one box, then -- using 'as list' -- the
result contains an extra 'document 1' and can't be used as a valid
reference. The solution is to get 'boxList' and test its class. If it
is not 'list' (but 'generic box') then you must coerce it to a list:
---
if class of boxList is not list then set boxList to {boxList}
---
And if there is no box at all, a try wrapper will be needed:
---
tell application "QuarkXPress 4.11"
open libDoc
tell document 1
try
set boxList to (object reference of every generic box of page modulPage whose name is tempModulTag)
on error
display dialog "There is no box named " & tempModulTag & "
on the page " & modulPage buttons "OK" default button 1 with icon 0
error number -128
end try
end tell
if class of boxList is not list then set boxList to {boxList}
repeat with boxRef in boxList
if (box type of boxRef) = text box type then set story 1 of boxRef to "test"
end repeat
end tell
---
Regards,
Hans
---
Hans Haesler | email@hidden