• 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: addressing words between tabs in Xpress
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: addressing words between tabs in Xpress


  • Subject: Re: addressing words between tabs in Xpress
  • From: Hans Haesler <email@hidden>
  • Date: Tue, 30 Apr 2002 21:41:21 +0200

On Tue, 30 Apr 2002, email@hidden wrote:

>The most embarrassing thing about this is I've already asked this question,
>got an answer and now can't find it. Please excuse me for asking this
>again...
>
>I have a text box in XPress (4.11 on 9.2) which contains something like:
>
>product name <tab> 10% Off <tab> #10 <tab> #20 <CR>
>product name <tab> 3 or more <tab> #29 <tab> #2 <CR>
>product name <tab> 10% Off <tab> #23 <tab> #10 <CR>
>
>and so on...
>
>What I want to achieve in pseudo-script is
>
>if discount contains "Off" then set color of bit between first tabs to
>"red"
>if discount contains "or more" then set color of bit between first tabs to
>"blue"
>
>My problem is that the product name can have a varying number of words and
>characters so I can't set words 3 thru 4 or characters 20 thru 30. As I
>said, someone did post a solution for me but I can't find it. If that
>person (or anyone) could send the answer direct to me as well as to the
>list, I promise to be eternaly greatful and not to lose the solution again.

Hey, Steve! Where have you been?!? ;-)

---
tell document 1 of application "QuarkXPress 4.11"
activate
tell story 1 of current box
repeat with i from 1 to count of paragraphs
if paragraph i contains "Off" then
try
set color of text from character after (character 1 where it = " ") to character -1 of paragraph i to "Red"
end try
else if paragraph i contains "or more" then
try
set color of text from character after (character 1 where it = " ") to character -1 of paragraph i to "Blue"
end try
end if
end repeat
end tell
end tell
---
Please unwrap the long lines, if necessary. And replace whatever you'll find
between the quotes of '(character 1 where it = " ")' by typing a tab.

---
Hans Haesler <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.

  • Prev by Date: Re: Satimage re_compile regex functions
  • Next by Date: Re: addressing words between tabs in Xpress
  • Previous by thread: addressing words between tabs in Xpress
  • Next by thread: Re: addressing words between tabs in Xpress
  • Index(es):
    • Date
    • Thread