Turn string separated by commas into list

Hi, how would I turn a string of words separated by commas into a list. Eg: “Item1, Item2, Item3” . Maybe taking spaces out of the string would help too…

Hi,

it’s very simple with text item delimiters


set theString to "Item1, Item2, Item3"
set {TID, text item delimiters} to {text item delimiters, ", "}
set theList to text items of theString
set text item delimiters to TID
theList

Wow! Thanks for that! :smiley:

I’m trying to make something that’ll open every application typed in. This is my code so far:

tell application "AppleScript Editor"
	set ap to text returned of (display dialog "Applications to open:" default answer "" buttons {"OK"} default button 1)
end tell

set {TID, text item delimiters} to {text item delimiters, ", "}
set ap to text items of ap
set text item delimiters to TID

I have this code to open an application:

do shell script "open -a \"" & ap & "\""

…but how do I get it to open every item in the list?


tell application "AppleScript Editor"
	set ap to text returned of (display dialog "Applications to open:" default answer "" buttons {"OK"} default button 1)
end tell

set {TID, text item delimiters} to {text item delimiters, ", "}
set appList to text items of ap
set text item delimiters to TID
repeat with anApp in appList
	do shell script "open -a " & quoted form of anApp
end repeat

That’s perfect! Thanks for all the help Stefan!