• 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
Looping through a list question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Looping through a list question...


  • Subject: Looping through a list question...
  • From: "Gregory Smith" <email@hidden>
  • Date: Mon, 04 Nov 2002 14:24:23 -0800

Hello Everyone,

Okay, I know this will probably be a dumb one on my part, but why can't I
loop through a list with only one item with out the looping 'seeing' the
single var as a list of text items???

-=-=- Begin Code -=-=-=-

-- some code

set listOFiles to name of every file in alias pathToRevFolder whose ,
name ends with selectedFileSuffix -- Get a list of all file names in
the 'Rev' folder
if (count of listOFiles) is not {} then
set versionCount to 0
repeat with aFile in listOFiles as text
--set aFile to aFile as text
set versionFlag to item 7 of aFile
if versionFlag is selectedFileVersion then
set versionCount to (versionCount + 1)
end if
end repeat
else
display dialog "No matching files types or revs in rev folder." as text
end if

-- more code

-=-=- End Code -=-=-=-

In the past, I remember simply just setting the var of the loop to be a text
item and away I went. What am I overlooking here? Code above works with an
empty list or a list of more than two vars. Only breaks (at --> set
versionFlag to item 7 of aFile) with one var (item) in list.

Thanks in advance for your help.
--

Cheers,
Greg
_______________________________________________
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.

  • Follow-Ups:
    • Re: Looping through a list question...
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Re: Removing characters from a string
  • Next by Date: Save from Photoshop as GIF with transparency?
  • Previous by thread: Re: iCal scripting samples
  • Next by thread: Re: Looping through a list question...
  • Index(es):
    • Date
    • Thread