Add Adding active scripting support to Delphi applications

1. Why scripting?

Why are scripting abilities needed in Delphi applications? There are many possible reasons.

-- For example, we are developing game. Many actors, many situations. Scripting is the good (and maybe the only flexible enough) way to let users (or addon developers) to:
- vary objects and actors properties, reactions, abilities etc.;
- add new objects and characters;
- create new game scenarios

-- Text processing applications. Perl is the best langauge to work with texts: search, replace, regular expressions. Perl can do much more then Delphi with texts. So we can mix them and take the best from both of them - why not? Write user interface in Delphi and let script extensions (using Active Perl) to handle texts.

-- How to create plugin-based application? There are copule of ways: DLLs (or BPLs), COM... Why not scripting? Make some interface to read and execute scripts in application, make specifications and go ahead: application is open to extension using any active scripts: VBScript, JScript, Perl, PHP, Rexx, Tcl... the only requirement is that corresponding active script extension must be installed in windows script host.

-- Installers are exactly those applications which need scripting abilities...

-- Any applications which must be managed from outside. For example, some application can consist of the set of all-sufficient objects and scripts loaded from outer storage may trigger any actions, change any parameters, allow/disallow any functionality of apllication objects.

-- Applications with variable execution sequence.

-- Etc, etc, etc...

2. What exactly is needed?

What are the basic requirements to scripting engine mixed with Delphi application, in the most of cases?

As practice shows, there is well-defined set of abilities wich scripter "must have", if it pretends to be universal scripting addon for Delphi application:

-- Support of most known scripting languages. VBScript and JavaScript, Perl, PHP. May be also Tcl, Rexx and other. In other words, any language which is supported by Windows scripting host engine.

-- Easy to integrate with Delphi application.
Ability to operate with Delphi application objects, their properties, events and methods; deleting and creating objects in script; passing object parameters to script procedures and functions.

-- Recognizing errors occured during script execution.

-- Quick and eminently qualified support answering to any questions - they will appear anyway, if you will be seriously engaged in scripting tasks in your applications.

-- Online help and manual containing all most important questions.

-- [ ] Add your ideas here.

3. Is there any component meeting these requirements?

Exactly! New version (2.0 is up to date on May 19, 2003) of Delphi script component named TekWSHControl (Windows scripting host control for Delphi) ( from Ekas Software ( is able to do everything described above, and even more.

Visit this scripter component home page and learn more about it. Almost all possible questions are coveraged there, and support will quickly answer the rest if any.

4. What are basic TekWSHControl advantages?

-- Any script language supported by Windows scripting host can be used for scripts: VBScript and JavaScript by default, Perl, Python, Rexx, TCL, PHP, XSLT and any other for which extensions are installed in Windows.

-- No need to implement OLE-server functionality for application or any object to be shared with scripting engine.

-- Any object descending from TPersistent can be added to script's namespace and operated within script environment, including all of its published members.

-- Any object descending from TComponent can be created within script and operated by script or by application after script is finished.
Recently used events of VCL components can be handled by script procedures (and you can add new events very easy if having source code of TekWSHControl component).

-- If control is added during script executing (in script procedure), event handlers for it are set automatically if any defined in script's body.

-- If control exists independently from scripts, event handlers for it may be set just by one line of code (like "Panel1.OnClick:= ekWSHControl1.OnClickHandler", and then event handling is redirected to script's procedure "Sub Panel1_OnClick()", if such present in scripts body).

-- Native VCL code.

-- Simplicity of use.

-- Delphi 4, 5, 6 and 7 support.
Related Discussions
    Find the handle of the window using FindWindow or EnumWindows and use PostMessage(ProgramHandle, WM_CLOSE, 0, 0); I have not tried it, but it...
  • HOW TO GREP CHARACTERS IN DELPHI 3 (2001-01-03 03:29:32)
    Var Grep : String; Begin Grep := Copy('2000-46',6,2); End; The first parameter is a string or a dynamic array, the second is the index of...
  • HOW CAN I DEBUG DLL (2001-01-03 02:48:24)
    Do you mean how to find internal errors while writing a DLL file or how to get the exact error while calling a DLL Function ? /Filip
  • USING DLLS (2001-01-04 01:47:50)
    Hi again Goober ... :o) Let's take NETAPI32.DLL as an example. This DLL is created by Microsoft and the explanation of its use is described in...
  • DOT ON SCREEN (2001-01-03 05:42:55)
    Delphi does not support a Pixel function with a HDC, you have to use the Windows-API-function COLORREF SetPixel( HDC hdc, // handle...
    Well, in design I think there is already an issue. Backend is more then just a database with which you connect. There should be a complete layer...
  • HELP WITH CHDIR !!!! TURBO PASCAL VS DELPHI (2001-01-03 08:48:49)
    This is because the ChDir Procedure, the SetCurrentDir and SetCurrentDirectory Functions are changing the directory in the active process. Try...
    One of the quirks of Delphi is that classes in the same unit can access protected and private methods and variables. Borland does this a lot in...
  • SENDING ICQ MSGS FROM DELPHI (2001-01-03 16:54:03)
    I tried the ICQ Api, but never used it. I've added a simple ICQPager component to delphipages (Winsock/TCPIP).. it might help... Q
    In the BDE on the other PC (the one without the database), you must add an alias to point to the location of the database in the format of:...
Latest News
Submit News Form Past News
Latest Forum Entries