Handler pointers

Is there a way to pass a handler/function pointer as a script parameter?

I am finding that I am cutting and pasting a lot of code from script to script and it's making me very nervous.

Basically, what I have is a script to test a lot of very similar functionality in our applications. If I could pass in a function pointer to the base script with a specific path of execution to follow and another pointer to the verification function that will verify everything worked or not I could reduce or maybe eliminate my cut and paste problem.

To date I haven't figured out a way to do this, never mind passing a variable length collection of them.

I thought about a very long if else construct but I don't think I like that idea any better than the cut and paste option.

Maybe someone out there knows how to do it or has a better way? (timtowtdi)


  • EggplantMattEggplantMatt ForumAdmin admin
    I think you just want to parameterize your scripts/handlers and call them directly. You can call a script from another script just by using the second scripts name. You can declare parameters for a script using the params keyword at the beginning of the script:
    params myVar, popsicle
    TypeText myVar
    Click popsicle

    You can call a command or function inside another script using a variety of syntaxes which are all in the documentation. Or you can say:
    start using scriptname
    and all the handlers in the scriptname script will be available to the current script as though they were declared directly in it.

    There is never any real necessity to copy code between scripts.

    Let us know if you have any other questions.
Sign In or Register to comment.