I have multiple elements in an XML file. I need to "tell" each of them to do something. Here's the code: Code: on tellEveryXMLElementWithName(elementContainer, elementName, codetorun) try tell application "System Events" set elements to XML elements of elementContainer repeat with I from 1 to count of elements set e_name to (get name of XML element I of elementContainer) as string if e_name is equal to elementName then log "The script got this far." run script codetorun end if end repeat end tell return "success" on error errMsg return errMsg end try end tellEveryXMLElementWithName set the_file to (choose file without invisibles) as string tell application "System Events" set file1 to XML file the_file tell file1 set thecode to "display dialog the /'hi'/" set successful to my tellEveryXMLElementWithName(file1, "tableViewCell", thecode) end tell end tell The dialog box never displays. I can set X to 0 and thecode to "set X to 5" and the value of X will remain 0. You may be thinking, "Here's your answer. Switch to a different programming language." My response to that is "I don't want to."