• 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: Does AppleScript have arrays within the language?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does AppleScript have arrays within the language?


  • Subject: Re: Does AppleScript have arrays within the language?
  • From: "Marc K. Myers" <email@hidden>
  • Date: Thu, 14 Dec 2000 00:01:23 -0500
  • Organization: [very little]

snorton wrote:
> Date: Wed, 13 Dec 2000 17:26:53 -0500
> From: email@hidden
> Subject: Re: Does AppleScript have arrays within the language?
> To: email@hidden
>
> There are three ways to approach this:
>
> 1. Loop through the files of the folder object
> 2. Get all the files into a list, and loop through the list
> 3. Tell the finder to do some thing to every file of the folder.
>
> Method 1 looks like this:
>
> tell application "Finder"
> repeat with eachFile in files of folder "Foo" of disk "Frisbee"
> set comment of eachFile to name of eachFile & " Test 1"
> end repeat
> end tell

Isn't this really an example of approach #2? <files of folder "Foo" of
disk "Frisbee"> is an expression that generates a list. I would think
that method 1 would really look like this:

tell application "Finder"
set fileCnt to count files of folder "Foo" of disk "Frisbee"
repeat with i from 1 to fileCnt
set theFile to file i of folder "Foo" of disk "Frisbee"
set comment of theFile to name of theFile & " Test 1"
end repeat
end tell

It's still creating a list to get the count of the files, but it's not
looping through it.

Marc [12/13/00 11:57:27 PM]


  • Prev by Date: Re: AScript Editors?
  • Next by Date: Re: scripting Photoshop
  • Previous by thread: Re: Does AppleScript have arrays within the language?
  • Next by thread: Re: Does AppleScript have arrays within the language?
  • Index(es):
    • Date
    • Thread