Product info

Add-on overview » xbScript

xbScript
A full featured scripting language engine
xbScript is a full featured scripting language engine that's compatible with any ActiveScript host like:
  • Windows Script Host (WSH)
  • Internet Explorer (IE)
  • Internet Information Server (IIS)
With xbScript, you can directly run .XBS source files from any command prompt or by clicking on a.XBS file from the Windows Explorer. xbScript Prompt is also a "Dot prompt"-alike utility where you can run external PRG code or administrate your xBase databases.
How much does xbScript cost?

xbScript requires no registration and is free of any cost. xHarbour Builder Enterprise includes a xbScript edition that has SQLRDD included. See the xHarbour Builder products page for more details.
What's new in the latest build?

xbScript now includes an xHarbour compatible native PCODE compiler. This translates to even higher compatibility with xHarbour, and a script execution speed comparable with compiled xHarbour applications. All of xHarbour syntax is now supported, except:
  • Module wide STATIC variables
  • Extended Codeblocks (Extended INLINE Methods are supported using another approach)
  • LOCAL, and STATIC variables are simulated using PRIVATE memvars
  • MEVARS, and FIELDS declarations are ignored
  • Detached LOCALs in Codeblocks, as we don't have real LOCALs
Where can I get xbScript?

The free version of xbScript can be downloaded from our xHarbour Community pages. Updates for this version are also availabe on the Community. The professional and / or enterprise version can be downloaded through your personal xHarbour account.
Multiple versions

xbScript comes in different personalities which are tied together very tightly.
1.xbScript DLL as ActiveScript Host or WSG, IE or IIS
For this you need xbScript DLL edition. xbScript DLL is a full featured scripting language, compatible with any ActitveScript Host like WSH (WScript.exe and CScript.exe), Internet Explorer (IE) or Internet Information Server (IIS).

You may embed xbScript source in:
  • .xbs file, executed directly from console, or by clicking it from explorer
  • .html file to be executed in client browser, same as with JScript, VBScript etc. Simply use:

    <SCRIPT LANGUAGE="XBSCript">
  • .asp file, executed on a server, same as with JScript, VBScript etc. Simply use:

    <%@ Language=XBScript %>
  • Executed in any language supporting OLE, by means of:

    oSE := CreateObject("ScriptControl")
    oSE.AllowUI := .T.
    // Now execute some xbScript
    oSE.Language = "XBSCript"
    oSE.ExecuteStatement("Alert(\"XBScript\")")
  • Executed by any Script Host compliant with the MS ActiveScript specifications.


These are some xbScript samples online at xHarbour.com:
http://www.xHarbour.com/xbs/buttons.htm
http://www.xHarbour.com/xbs/clock.htm
http://www.xHarbour.com/xbs/fade.htm
http://www.xHarbour.com/xbs/scroller.htm
http://www.xHarbour.com/xbs/dynhtml.htm
http://www.xHarbour.com/xbs/ServerVariables.asp
2. A 100% Clipper compatible Pre-Processor with some extensions
For this you will need the xbScript-Prompt edition. Executing xbScript.exe followed by a source file name and the -P switch, will create <filename.pp$> which is the equivalent of the Clipper PPO file. A Clipper PPO of xbScript PP$ file is the result of the preprosessed PRG source file.

Syntax:
xbScript.exe filename[.ext] -P

Optional command line switches in this mode:

-CCH
Generate a .cch file (compiled command header).

-D <id>
#define <id>.

-D:E
Show tracing information in the expression Scanner.

-D:M
Show tracing information into the Match Engine.

-D:P
Show tracing information into the Output Generator.

-FIX
Do not clone Clipper PreProcessor bugs.

-l<path>
#include file search path(s) (';' seperated).

-Q
Quiet.

-U
Use command definitions set in (or none).

3. xbScript Prompt, which allows most of the Clipper syntax
For this you will need the xbScript-Prompt edition. In this mode you can execute a single line at a time by typing the line and pressing the [Enter] key.It does support IF [ELSE] [ELSEIF] ENDIF in DOT environment.

Executing xbScript with no source filename will start the DOT prompt mode.

Additionally you may type:
DO filename.prg [ENTER]

So that DOT will "run" the specified source file. This interpreter mode is subject to few limitations:
A - It does support LOCAL/STATIC/PRIVATE/PUBLIC, but:
• STATICs are actually implemented as publics.
• LOCALS have scoping of locals but are implemented as privates so you can't have a LOCAL and a PRIVATE with the same name.

B - Non-declared variables are auto-created on assignment in Harbour but NOT in Clipper (yet).
C - It does support definition and execution of prg-defined FUNCTIONs/PROCEDUREs.
D - It does support all control flow structures including:

BEGIN SEQUENCE [BREAK] [RECOVER] END SEQUENCE
TRY [CATCH [<xCatcher>]] END.
FOR EACH <Enumerator> IN <Enumeration>

This will create rp_dot.pp$ compilation trace file.

xbScript is using pre-burned rules to support this functionality, unless a file named rp_dot.ch is present. If rp_dot.ch is present xbScript will load rp_dot.ch instead of using the pre-burned rules. If this file doesn't include all the needed rules, the functionality of the the Dot Prompt mode may be faulty.
4. Finally, xbScript is a limited Clipper/Harbour/xBase Interpreter
For this you will need the xbScript-Prompt edition. Subject to those same few limitations it can execute most of Harbour syntax. Executing xbScript-Prompt followed by a source file name and the -R switch will "RUN" that source (it will also create the rp_run.pp$ compilation trace file).

Syntax:
xbScript.exe filename[.ext] -R

In this mode these are the optional command line switches:

-CCH
Generate a .cch file (compiled command header).

-D <id>
#define <id>.

-D:E
Show tracing information in the expression Scanner.

-D:M
Show tracing information into the Match Engine.

-D:P
Show tracing information into the Output Generator.

-FIX
Do not clone Clipper PreProcessor bugs.

-l<path>
#include file search path(s) (';' seperated).

-Q
Quiet.

-U
Use command definitions set in (or none).


So that DOT will "run" the specified source file. This interpreter mode is subject to few limitations:
A - It does support LOCAL/STATIC/PRIVATE/PUBLIC, but:
• STATICs are actually implemented as publics.
• LOCALS have scoping of locals but are implemented as privates so you can't have a LOCAL and a PRIVATE with the same name.

B - Non-declared variables are auto-created on assignment in Harbour but NOT in Clipper (yet).
C - It does support definition and execution of prg-defined FUNCTIONs/PROCEDUREs.
D - It does support all control flow structures including:

BEGIN SEQUENCE [BREAK] [RECOVER] END SEQUENCE
TRY [CATCH [<xCatcher>]] END.
FOR EACH <Enumerator> IN <Enumeration>

E - The compiled module is automatically using -n (No implicit startup procedure) if the script starts with a Procedure/Function definition.
F - Built-in OLE COM Client gateway is included when PP is compiled with xHarbour.

xbScript is using pre-burned rules to support this functionality, unless a file named rp_run.ch is present. If rp_run.ch is present xbScript will load rp_run.ch instead of using the pre-burned rules. If this file doesn't include all the needed rules, the functionality of the the Interpreter mode may be faulty.