Re: Quark Object Reference HELP
Re: Quark Object Reference HELP
- Subject: Re: Quark Object Reference HELP
- From: Stan Cleveland <email@hidden>
- Date: Mon, 23 Apr 2007 17:25:01 -0700
- Thread-topic: Quark Object Reference HELP
Title: Re: Quark Object Reference HELP
On 4/23/07 2:19 PM, Oakley Masten wrote:
> set RefText to (item 3 of ListOfReferences as
> reference)
>
> (*
> a single reference from the list looks like this:
> text from character 313 to character 316 of story 22
> of document "SPR07B2_C_MM_4041_102" of application
> "QuarkXPress"
> *)
>
> set theAnswer to RefText as text
>
> --gives me #102
> ------------------------------------------
> (*
> so my question is:
>
> How can I parse out the object reference so that I can
> collect the text from the object reference plus the
> next 15 characters in the story.
>
> I can’t get the actual text of the reference into a
> variable to work on.
>
> What I want to do is :
> Set StoryNumber to story (22)
> Set StartCharacter to from character (313)
> Set EndCharacter to character (316)
>
> How do I do it?
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 you must 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. Either way works.
HTH,
Stan C.
_______________________________________________
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