Get a handler from a script

Thomas McGrath III 3mcgrath at adelphia.net
Thu Mar 16 21:48:48 EST 2006


Mark and Robert,

I needed to check for functions as well. So I adapted the script from  
Mark into this:

function getHandlers hName,tControl
     put the script of card tControl into tScript
     put tScript
     get lineOffset("on " & hName,tScript)
     if it = 0 then
         get lineOffset("function " & hName,tScript)
     end if
     if it = 0 then return "not found"
     put it into startLine
     get lineOffset("end " & hName,tScript)
     return line startLine to it of tScript
end getHandlers

Thank you so much for your help,

Tom


On Mar 16, 2006, at 9:16 PM, Mark Smith wrote:

> Not tested, but something like this should work:
>
> function getHandler hName,tControl
>   put the script of control tControl into tScript
>   get lineOffset("on " & hName,tScript)
>   if it = 0 then return "not found"
>   put it into startLine
>   get lineOffset("end " & hName,tScript)
>   return line startLine to it of tScript
> end getHandler
>
> Cheers,
>
> Mark
>
> On 17 Mar 2006, at 01:25, Thomas McGrath III wrote:
>
>> Hello friends,
>>
>> I know how to get the script from an objects script via script:     
>> put the script of card "Foo" into tBar
>>
>> 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
>>
>> Anyone know how to do this easily?
>>
>> Thanks
>>
>> Tom




More information about the Use-livecode mailing list