An AppleScript list iterate/loop example

AppleScript list FAQ: How do I iterate/loop over an AppleScript list?

As I continue to work on my Mac speech recognition software projects, I've often found the need to loop over an AppleScript list. One way to loop over an AppleScript list is to use the AppleScript repeat with syntax:

set myList to {"Hello", "Goodbye", "I must be going"}
repeat with theItem in myList
  say theItem
end repeat

In this example, I'm iterating over each item in my AppleScript list, and then using the AppleScript say command to speak each item in the list.

Post new comment

The content of this field is kept private and will not be shown publicly.