item 5 of myList
set the_String_List to {"First String", "Second String", "Third String", "Fourth String", "Fifth String", "Sixth String"}
repeat with i from 1 to number of items in the_String_List
set this_item to item i of the_String_List
display dialog "Item : " & i & return & "String : " & this_item with title "List Items" giving up after 3
end repeat
set mystring to "string with a , in it"
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set pieces to text items of mystring -- break string apart at commas
set AppleScript's text item delimiters to "" -- or whatever replaces the comma
set mystring to pieces as text -- put string back together using whatever
set AppleScript's text item delimiters to TID
return mystring
set mystring to "string with a , in it"
set mywords to words of mystring
--> {"string", "with", "a", "in", "it"}
mywords as string --> "stringwithainit"
-- That is squished together because no text "" is put between the items.
-- but if we set the AppleScript's text item delimiters to space...
set AppleScript's text item delimiters to space
set MW to mywords as string
set AppleScript's text item delimiters to "" -- ALWAYS SET THEM BACK
MW --> "string with a in it"
tell application "iTunes" to set foo to (get name of tracks of playlist 1)
repeat with bar from 1 to (count foo)
set item bar of foo to escapeString_(item bar of foo)
end repeat
return foo
on escapeString_(someText)
set escapeCharacter to "\\" -- escape the escape character
repeat with anItem in {",", "(", ")"} -- the items to escape
if anItem is in someText then -- escape it/them
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, anItem}
set {pieces, AppleScript's text item delimiters} to {text items of someText, escapeCharacter & anItem}
set {someText, AppleScript's text item delimiters} to {pieces as text, tempTID}
end if
end repeat
return someText
end escapeString_
tell application "iTunes" to set foo to (get name of tracks of playlist 1)
repeat with bar from 1 to (count foo)
set item bar of foo to quoted form of (item bar of foo)
end repeat
return foo