By Alvin Alexander. Last updated: March 6, 2018
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 a 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 iterate over each item in my AppleScript list, and then use the AppleScript say
command to speak each item in the list.