Hello all! New Scripter in the forum! I’m also new to AppleScript but I’ve done a fair amount of reading and practices to have a decent grasp of the fundamental.
I’ve just learned that in AppleScript we don’t “delete” or “remove” items from a list. Instead we have to create a new list without the item. With that said, I was trying to make an interaction where user can pick from a list of items and it will present a new list without the item that was previously selected.
As an example, this is what I started. User can select one person to eliminate from a list of people and it repeats until everyone is eliminated.
set pplList to {"Bob", "Amy", "Tod", "Ivy", "Joy", "Sam"}
set i to length of pplList
repeat until i is 0
choose from list pplList with prompt "Pick one person to eliminate:"
set i to i - 1
end repeat
Obviously this would just run the choose list prompt 6 times with the same list of people each time.
My novice self know I have to construct a new list without the person user selected, so I’ll definitely need to use the result from the first choose from list like
Set removedPerson to result
Then make a new choose from list with the new list and make it repeat until all people are eliminated.
All of the similar posts I’ve seen are working with numbers and using items n through n. This seems to be a bit harder because we are working with random order that user defined. Also since the choose from list is in the repeat loop, the result from making a selection is an integer.
Thank you all for your education!
Edit: Typos