• 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: loop to build a list?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loop to build a list?


  • Subject: Re: loop to build a list?
  • From: Martin Crisp <email@hidden>
  • Date: Tue, 18 Feb 2003 12:53:17 +1100
  • Organization: Tesseract Computing

On Mon, 17 Feb 2003 20:10:17 +1100, James Burns wrote
(in message <email@hidden>):

> Hello:
>
> I've, once again, run into the limitations of my knowledge or
> ability... This is what happens when a Fine Art major attempts to
> code...

There should be a law ;-)

> I'm trying to extract information from a formatted text file, and what
> I want to end up with is a list of the items extracted. Is there a good
> generalized routine for accumulating results into a list while
> repeating?
>
> Here's the chunk that I'm working on, but it won't make a whole lot of
> sense out of context:


set gotit to {}

> set AppleScript's text item delimiters to "{" -- Check out lines of
> file starting with open bracket
> set i to text items of extContent -- for each line
> repeat with foundString in i -- repeat loop
> if foundString contains "ImageSaver" then -- further narrowing
> selection
> set AppleScript's text item delimiters to " " -- break into "words"

Rather than setting the TIDs here, you'd get a little more speed by
moving it to just before the repeat loop. [and don't forget to set
it back afterwards]

> set gotIt to {text item 8 of foundString}

Change that to:
set end of gotit to {text item 8 of foundString}

> log gotIt -- Here gotit has the value I want
> end if
> end repeat
>
> This produces a log that successfully lists the values I want, on each
> repeat, but I want it stuck in a list for storage and manipulation.
> Does that make sense?
>
> Thanks in advance for your help.

Have Fun
Martin
--
I have absolutely no reason to complain about "success" with my
work; [...] And yet, from time to time a boundless sense of
inferiority plagues me, a desperate feeling of general failure; how
does a person acquire such bits of lunacy?
- MC Escher

Almost always SMASHed
_______________________________________________
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.

References: 
 >loop to build a list? (From: James Burns <email@hidden>)

  • Prev by Date: Re: loop to build a list?
  • Next by Date: Re: Folder: alias:true/false property
  • Previous by thread: Re: loop to build a list?
  • Next by thread: Re: loop to build a list?
  • Index(es):
    • Date
    • Thread