Re: object Reference Question V2
Re: object Reference Question V2
- Subject: Re: object Reference Question V2
- From: Stan Cleveland <email@hidden>
- Date: Tue, 24 Apr 2007 15:04:59 -0700
- Thread-topic: object Reference Question V2
Title: Re: object Reference Question V2
On 4/24/07 2:08 PM, Oakley Masten wrote:
> Thank you so very much Stan!!
> I think this will get me to where I need to be with a
> little work.
>
> The only additional question I have is: How do I deal
> with multiple instances of the referenced text in a
> single text box. Unfortunately, the designers put
> more than one product in a single box on the page.
>
> To put the question another way: How do I get multiple
> offsets in one large text variable?
Give this a try, Oakley. --Stan C.
-- grab text (not object references) from Quark
tell application "QuarkXPress"
set findText to "cannot"
set objRefList to object reference of every text of story 1 of text box 1 of page 1 of document 1 where it's text is findText
set objRefCount to count of objRefList
set theStory to contents of story 1 of text box 1 of page 1 of document 1
--> "Gravitation cannot be held responsible for people falling in love. Gravitation cannot be held responsible for people falling in love. Gravitation cannot be held responsible for people falling in love."
end tell
-- use applescript (not Quark) to 'measure' each occurrence the text
set textLen to length of findText
--> 15
set offsetList to {}
set currentOffset to 1
repeat with i from 1 to objRefCount
set currentOffset to currentOffset + (offset of findText in (text currentOffset thru -1 of theStory))
--> 14, 81, 148
set end of offsetList to currentOffset
end repeat
-- now go back to Quark for each occurrence of extended text
tell application "QuarkXPress"
repeat with thisOffset in offsetList
set startOffset to thisOffset - 1
set endOffset to startOffset + textLen - 1 + 15 -- 15 = length of extension to text
set extText to object reference of text from character startOffset to character endOffset of text box 1 of page 1 of document 1
-- manipulate each block of text as needed
set font of extText to "Arial Black"
set color of extText to "Blue"
end repeat
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden