• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Xpress 4.11 - further colour question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xpress 4.11 - further colour question


  • Subject: Re: Xpress 4.11 - further colour question
  • From: Shane Stanley <email@hidden>
  • Date: Sat, 27 Apr 2002 08:29:13 +1000

On 26/4/02 11:49 PM +1000, Hans Haesler, email@hidden, wrote:

> I think this is rather due to a conflict between the offset of a character
> in the story and the position of the same character in the paragraph.
> These two values are not equal.
>
> When you get the offset of a character then the result is the number
> of characters which are before this character, but counted from the
> beginning of the story.
>
> In your example, the offset of the character "p" of "prod 4" is '21'.
> The offset of the tab in the same paragraph is '27'. But when you count
> the characters from the beginning of paragraph 4 then the tab is
> 'character 7'.
>
> Because you address the range of characters inside of the paragraph,
> you must subtract the offset of the tab from the one of the first
> character: 27 - 21 = 6. But character 6 is the one _before_ the tab.
> I think the color must be applied beginning with the character _after_
> the tab. So we must add 2 to the result for the start character or
> subtract 2 from the offset of character 1 of the paragraph:
> ---
> tell document 1 of application "QuarkXPress 4.11"
> activate
> tell current box
> repeat with i from 1 to count of paragraphs
> tell paragraph i
> try
> set offOne to (offset of character 1) - 2
> set offTab to (offset of every character where it is " ") as list
> set color of (characters ((item 1 of offTab) - offOne) thru -1) to "Red"
> end try
> end tell
> end repeat
> end tell
> end tell
> ---

You can also ignore the offsets altogether:

tell application "QuarkXPress 4.11"
tell document 1
tell story 1 of current box
repeat with i from 1 to count of paragraphs
try
set color of text from character after (character 1 where it = " ") to
character -2 of paragraph i to "Red"
end try
end repeat
end tell
end tell
end tell

--
Shane Stanley, email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Xpress 4.11 - further colour question
      • From: Hans Haesler <email@hidden>
References: 
 >Re: Xpress 4.11 - further colour question (From: Hans Haesler <email@hidden>)

  • Prev by Date: Re: "mylist" vs "a reference to" - speed difference
  • Next by Date: Re: Reco Label Stringer
  • Previous by thread: Re: Xpress 4.11 - further colour question
  • Next by thread: Re: Xpress 4.11 - further colour question
  • Index(es):
    • Date
    • Thread