• 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: Stepping through lines in a variable of text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stepping through lines in a variable of text


  • Subject: Re: Stepping through lines in a variable of text
  • From: Andy Wylie <email@hidden>
  • Date: Sat, 01 Dec 2001 13:33:35 +1300

on 1/12/01 12:13 PM, email@hidden at email@hidden wrote:

> I need to do the same thing, but reading line-by-line through a global
> variable of text.
>
> I'm guessing it would be something like:
>
> repeat with x = 1 to the number of lines in textvariable
> set linetoread to line x of textvariable
> -- do analysis of that line (linetoread) here
> end repeat
>
> That's the way I'd do it in Macromedia Director-Lingo - - - how would I do
> this in AppleScript? It doesn't appear to like the "repeat with x = 1" part.

set textvariable to "I am
the line to read
of text variable"

set AppleScript's text item delimiters to return
set lineStringList to text items of textvariable
set AppleScript's text item delimiters to ""

repeat with i in lineStringList
display dialog i
end repeat

_____________________________ Andy


  • Follow-Ups:
    • Tell default browser to open a URL
      • From: JollyRoger <email@hidden>
  • Prev by Date: Re: alias broker
  • Next by Date: Re: Stepping through lines in a variable of text
  • Previous by thread: Re: alias broker
  • Next by thread: Tell default browser to open a URL
  • Index(es):
    • Date
    • Thread