• 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: Looping through a list with only one item problem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looping through a list with only one item problem?


  • Subject: Re: Looping through a list with only one item problem?
  • From: AppleScript Guru <email@hidden>
  • Date: Tue, 19 Mar 2002 20:26:13 -0500

Gregory,

on 3/19/02 5:39 PM, you said:

> I have written a script that performs as expected with one exception; when a
> list contains only one item, the script will fail. The loop will attempt to
> read each character of the single item text name instead of the single item
> as a string.
>
> What would be the proper way to force a single item in a list (or ?) to be
> in fact a single item or is a single item list by definition NOT a list?

---> You can coerce the names to a list as you retrieve them. I.e.,

set my_File_Name_List to name of every item of folder "test" of startup disk

Another option would be to use the "list folder" command, which will always
return a list. I.e.,

set my_File_Name_List to list folder alias "Macintosh HD:test:"

The above doesn't need to be in a finder tell block either.

-Ben

Benjamin S. Waldie
Write Track Media
(AppleScript GuRu)

AppleScript Web Site:
http://www.AppleScriptGuru.com
http://www.wtmedia.com
_______________________________________________
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: 
 >Looping through a list with only one item problem? (From: "Gregory Smith" <email@hidden>)

  • Prev by Date: Re: AppleScript CGI Limitations
  • Next by Date: Rounding
  • Previous by thread: Looping through a list with only one item problem?
  • Next by thread: Applescriptable FTP Tools
  • Index(es):
    • Date
    • Thread