function putHandler newHandler,scriptText
-- Place a handler into a script.
-- Given the name of a handler and a script, this handler puts
-- the text of the specified handler into the specified script,
-- replacing the previous version of the handler in that script.
put word 2 of newHandler into handlerName
put getHandler(handlerName,scriptText,true) into offsets
put item 1 of offsets into startChar
put item 2 of offsets into endChar
put newHandler & return into char startChar to endChar of scriptText
return scriptText
end putHandler
This article is adapted from the Claris Tech Info database.