How can I find the intersections between multiple lists of names in apple script?
I want to compare multiple lists of names with apple script and have it spit out the names that are in all of the lists. I have been able to get it to compare two lists and give out the intersecting names, but I can't compare more than two lists at one time. Below is the script I have found online. However, I would like to compare names between multiple different lists. How can I make it compare multiple lists and give the common names between all of them?
set listA to {"red", "green", "blue"}
set listB to {"green", "blue"}
to intersection of listA against listB
local newList, a
set newList to {}
repeat with a in listA
set a to contents of a -- dereference implicit loop reference
if {a} is in listB then set end of newList to a
end repeat
newList
end intersection
intersection of listA against listB --> {"green", "blue"}
MacBook Air, OS X Yosemite (10.10.3), null