check if handler exist before using it
ambassador at fourthworld.com
Fri Nov 9 10:51:35 CST 2007
> As I'm doing an administration tool, I have to take care
> of differents scenarios , so for instance,
> having to deal with protected scripts which I didn't write myself,
> and without the password....
You may be able to use "try" to see if a "handler not found" error is
In circumstances where I have control over the stacks being queried I've
used a custom prop containing a list of "public" handlers for easy
access by other scripts. It does require an extra step to create that
list, but it can be automated during development with a
handler-collecting function like the one Mark Schonewille listed.
But I must admit that the circumstances in which such a mechanism was
useful have been very rare for me. How often do you need to call a
handler without knowing whether it's present?
Usually in my own work I find that I can implement conditional behaviors
more easily with property settings, so merely querying the customKeys of
an object tells me what I need to know, without having to resort to a
handler list among them.
Finding the best solution for your circumstance will of course require
that we know a bit more about it. Can you describe the setup for us?
Managing Editor, revJournal
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode