there is no explode keyword in plain AppleScript.
You probably use a Scripting Addition or you talk to an application, whose dictionary contains this keyword
Thanks for the quick reply Stefan, at the top of my script I have,
on explode(separator, input)
local separator, input
if separator is "" then return false
set ASTID to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {separator}
set input to text items of input
end try
set AppleScript's text item delimiters to ASTID
return input --> list
end explode
which is followed by
on clicked theObject
tell window of theObject
if the name of theObject is equal to "connectbutton" then
set emailaddress to contents of text field "usernamefield" as text
set myusername to item 1 of explode("@", emailaddress) as text
...
but as soon as I click the button I get the error?
within a tell block you must add my,
because the window has no idea what a handler is. my passes the request to AppleScript itself, which can execute the handler
.set myusername to item 1 of my explode("@", emailaddress)
.
Note: the as text coercions are probably not needed, a text field contains text