Ekas Software Windows Script Host Control for Delphi Help
Calling script functions and procedures from Delphi application
Quick start: common questions
To call script procedures and functions from Delphi applications, use TekWSHControl.RunProc function.

If script routine has no parameters, the only parameter 'Name' (a name of routine to be called) must be passed. If script routine has parameters then you have to pass them in open array [Param1, Param2, ..., ParamN]. Script control then checks if procedure with given name exists in script and if it has given number of parameters and runs routine or throws corresponding exception.

Please note that only OleVariant compatible types can be passed as parameters of script routines.

If you need to pass Delphi object as parameter of script procedure or function, then you have to use TekWSHControl.GetOleObject function.

For example: you need to pass Button1 (of type TButton) instance and some integer parameter to procedure SomeProcedure(ObjectParam, IntParam) in script, then in Delphi program it will be done like:

ekWSHControl.RunProc('SomeProcedure', [GetOleObject(Button1), 1000])


Ekas Software Windows Script Host Control for Delphi Help
Copyright (c)2002,2003 Ekas Software