Get a handler from a script

Mark Wieder mwieder at
Thu Mar 16 22:17:07 EST 2006


Thursday, March 16, 2006, 5:25:12 PM, you wrote:

> But, I would like to get just one of the handlers from a script via
> script:    put handler "FooBar" of the script of card "Foo" into tBar

Here's a simplified version of what I do:

-- pHandler is the name of the handler to extract
-- pScript is the entire script text
function FindHandler pHandler, pScript
  local tStart, tEnd

  put lineOffset("on" && pHandler, pScript) into tStart
  put lineOffset("end" && pHandler, pScript) into tEnd
  return line tStart to tEnd of pScript
end FindHandler

-Mark Wieder
 mwieder at

More information about the Use-livecode mailing list