Scripting in FinalBuilder

   

 

FinalBuilder supports VBScript and JavaScript languages (via Active Scripting) and also Python and PowerShell scripting (via the PowerShell runtime).

 

PowerShell

 

To use PowerShell in FinalBuilder you need to have PowerShell 1.x installed on your machine.  The download at the time of writing is: http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx

 

Python

 

Python support is included with FinalBuilder, using Microsoft's IronPython 2.0.

 

VBScript and JavaScript

 

To use VBScript and JavaScript you need to have Active Scripting installed on your machine (this should be installed by default).  If you don't have Active Scripting support installed, or you want to upgrade Active Scripting on your machine, the download for Windows Script 5.6 is:

http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en

 

Debugging

 

Active scripting based languages can be debugged using the Active Script Debugger, provided the language vendor supports debugging. To enable debugging you will need the Active Script Debugger installed, or Visual Studio.NET (which overrides the script debugger).  PowerShell and Python script debugging is not yet possible.

 

What can I do in the Scripts

 

VBScript and JavaScript scripts can make use of almost all the functionality of Active Scripting, including external COM/ActiveX calls.  PowerShell scripts can make use of all the PowerShell functionality. Python scripts can use IronPython and .NET Framework built-in functionality, as well as Python standard libraries if these are installed.

 

FinalBuilder Script Events are Triggered Before and After an Action Executes. See Action Script Events for more information on these events.

 

There is also a Run Script action.

 

Using FinalBuilder Variables in Scripts

 

FinalBuilder variables are available in script events as global variables. You can reference them just as you would any other identifier.  In PowerShell, you must access FinalBuilder variables with the following syntax:

$FBVariables.GetVariable(<variablename>) and $FBVariables.SetVariable(<variablename>)

 

Using Action List Parameters in Scripts

 

Action List Parameters are available in script events as global variables (same as FinalBuilder variables.)

 

Including External Scripts

 

You can include external script files in your VBScript and JavaScript action scripts, by inserting a comment with "USEUNIT scriptfilename"  You cannot include external script files with PowerShell.

 

Example - VBScript

 

'USEUNIT c:\FinalBuilder\scripts\iis_stuff.vbs

 

Example - JavaScript

 

//USEUNIT c:\FinalBuilder\scripts\iis_stuff.js

 

Note that the external script file must be written in the same script language as the event handler script. FinalBuilder provides sample scripts to do things such as restart IIS, shut down COM+ components, etc.

 

You can also use FinalBuilder variables in the path, for example :  'USEUNIT "%SCRIPTPATH%\Test.vbs"

Note that this is the only time you would use the %variable% syntax for FinalBuilder variables in the script editor, as the useunit line is preprocessed before the script is run.

 

Custom Action Studio Script Actions

 

Entire action types can be written in Action Studio for inclusion in FinalBuilder.

 

See Also

 

Related documentation and VBScript/JavaScript languages descriptions can also be found on the Microsoft Active Scripting site:

 

http://msdn.microsoft.com/scripting/

 

PowerShell documentation can be found at the Windows PowerShell site:

 

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

 

Information about IronPython can be found at the IronPython home page on Codeplex:

 

http://www.codeplex.com/IronPython

 

 

Global Script Functions | Action Script Events | Accessing TStrings based Properties