• 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: Help with find text command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with find text command


  • Subject: Re: Help with find text command
  • From: has <email@hidden>
  • Date: Wed, 1 Aug 2007 23:22:04 +0100

William Wallace wrote:

The overview of what I'm doing is:

Search through all the text flows in a bunch of InDesign layouts and
wherever I find a 10 digit ISBN, look it up in a spreadsheet and find the
current price, convert the 10 digit ISBN to a 13 digit ISBN and add both the
new price and the 13 digit ISBN to the text flow immediately after the
original ISBN.


-- find 10-character substrings that may be an ISBN
set possMatches to find text "\\<[[:digit:]][[:digit:]-]{8}[[:digit:] X]\\>" in theText with regexp and all occurrences


-- note: since source text is being modified, start at end and work back
repeat with possMatch in (get reverse of possMatches)
set isISBN to true
try
-- confirm it's an ISBN
find text "^[[:digit:]]{1,5}-[[:digit:]]{1,7}-[[:digit:]] {1,7}-[[:digit:]X]$" in matchResult of possMatch with regexp
on error number 1 -- no match
set isISBN to false
end try
if isISBN then
set startPosition to matchPos of possMatch
set endPosition to startPosition + (matchLen of possMatch)
-- replace original text here
end if
end repeat



HTH

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html

_______________________________________________
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
  • Follow-Ups:
    • Re: Help with find text command
      • From: has <email@hidden>
  • Prev by Date: Re: Akua Sweets
  • Next by Date: Re: Akua Sweets
  • Previous by thread: Re: Help with find text command
  • Next by thread: Re: Help with find text command
  • Index(es):
    • Date
    • Thread