object Reference Question V2
object Reference Question V2
- Subject: object Reference Question V2
- From: Oakley Masten <email@hidden>
- Date: Tue, 24 Apr 2007 14:08:14 -0700 (PDT)
On April 23 2007 Stan Cleveland wrote:
--This is a bit primitive, but should give you a start
( red = variables, green = comments):
-- grab text (not object references) from Quark
tell application "QuarkXPress"
set sel to selection
--text from character 192 to character 206 of story 1
of text box 1 of layout space "Layout 1" of project
"Project1" of application "QuarkXPress"
set sel to sel as text
--"hand on a stove"
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. How on earth can you explain in
terms of chemistry and physics so important a
biological phenomenon as first love? Put your hand on
a stove for a minute and it seems like an hour. Sit
with that special girl for an hour and it seems like a
minute. That's relativity. --Albert Einstein."
end tell
-- use applescript (not Quark) to 'measure' the text
set selStart to offset of sel in theStory
--192
set selLen to length of sel
--15
-- now go back to Quark for extended selection
tell application "QuarkXPress"
set extText to object reference of (text from
character selStart to character (selStart + selLen - 1
+ 15)) of text box 1 of page 1 of document 1
--text from character 192 to character 221 of text
box 1 of page 1 of document "Project1" of application
"QuarkXPress"
set font of extText to "Arial"
end tell
(*
The variable extText now holds a manually-specified
object reference to the extended text that you can
manipulate in Quark as you see fit. Note that youmust
use one less than the length of the original
selection, then add the length of the extension (15 in
this case) to get the correct ending position of the
extended text. You©ll also note that my manual object
reference uses ©¯document© rather than ©¯layout
space© and ©¯project© that Quark uses. Eitherway
works.
HTH,
Stan C.
*)
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?
Thanks
Oakley
_______________________________________________
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