• 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: Select text (numeric words) between brackets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select text (numeric words) between brackets


  • Subject: Re: Select text (numeric words) between brackets
  • From: kai <email@hidden>
  • Date: Thu, 3 Aug 2006 01:03:03 +0100


On 1 Aug 2006, at 16:44, Jan Bultereys wrote:

Does anyone knows how to grap a text which is between brackets (brackets also selected)?
I want to put a style on every text which is selected and is between brackets in Quark 6.5

Not sure quite how you might apply the results in Quark, Jan - but the 'offset_list' handler below should produce a list of beginning/ end positions for any text between two given string 'wrappers'. If you wish to include the wrappers (in this case the open and close parentheses), simply use the expression 'with wrappers' in place of 'without wrappers'.


Forgive me if I use Tex-Edit Plus once more to demonstrate how this might work:

---------

on offset_list for t from b to e given wrappers:w
set {d, w, text item delimiters} to {text item delimiters, w as integer, b}
set {l, m, c, r, text item delimiters} to {t's text items, 1 - w, count b, {}, d}
set {v, s} to {c * m + 1 + (count l's beginning), w * (c + (count e) - 2) - m * 2}
repeat with i in rest of l
tell (offset of e in i) to if it > m then set r's end to {v, v + s + it}
set v to v + c + (count i)
end repeat
r
end offset_list


tell application "Tex-Edit Plus" to repeat with i in my (offset_list for selection from "(" to ")" without wrappers)
set style of selection's text from character (i's beginning) to character (i's end) to {bold, italic}
end repeat


---------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Select text (numeric words) between brackets
      • From: Jan Bultereys <email@hidden>
References: 
 >Select text (numeric words) between brackets (From: Jan Bultereys <email@hidden>)

  • Prev by Date: reconnect fetch using applescript
  • Next by Date: Re: Help with apple script
  • Previous by thread: Re: Select text (numeric words) between brackets
  • Next by thread: Re: Select text (numeric words) between brackets
  • Index(es):
    • Date
    • Thread