Global Script functions

   

Global Scripting Functions

 

Apart from standard VBScript/JavaScript/PowerShell functions, FinalBuilder exposes the following global functions :

 

procedure  SaveProject;

Saves the current FinalBuilder project.

 

function ExtractFilePath(value : string) : string;

Extracts the path (minus the filename) from a fully qualified filename.

 

function ExtractFileName(value : string) : string;

Extracts the FileName (minus the path) from a fully qualified filename.

 

function ExtractFileDrive(value : string) : string;

Extracts the filename drive letter

 

function ExtractFileExt(value : string) : string;

Extracts the file extension including the period

 

function ExpandUNCFileName(FileName : String) : String;

Expands any pathname to either the fully qualified UNC pathname (ie \\server\share\folder\file.txt) or (if the file is a local file)

the fully qualified local pathname (ie C:\folder\file.txt.)

 

procedure FBSetCaption(value : string);

Sets the titlebar caption for FinalBuilder

FBSetCaption does nothing when FinalBuilder is run from the scheduler.

 

function GetClipBoardText : string;

Gets the text currently on the clipboard

GetClipBoardText does nothing when FinalBuilder is run from the scheduler.

 

procedure CopyToClipBoard(const value : string)

Copies the string to the clipboard

CopyToClipBoard does nothing when FinalBuilder is run from the scheduler.

 

function FBFormatDateTime(format : string; value : DateTime) : string;

Formats the specified DateTime as a string

See Format DateTime Formatting Options

 

function StrToDate(value : string) : DateTime;

Converts a string into a Date

 

function StrToDateTime(value : string) : DateTime;

Converts a string into a DateTime

 

function ChangeFileExt(filename : string; newext : string) : string;

Changes the file extension of filename to the specified new extension.

eg. ChangeFileExt("c:\temp\test.txt", ".doc") = "c:\temp\test.doc"

 

function IncludeTrailingPathDelimiter(value : string) : string;

Appends a trailing path delimiter to the specified directory if required.

 

function ExcludeTrailingPathDelimiter(value : string) : string;

Removes a trailing path delimiter from the specifed directory if it exists.

 

function ExpandFileName(value : string) : string;

Expands the short filename and path to the fulll filename/path

 

function FileExists(value : string) : boolean;

Returns true if the specified file exists

 

function GetCurrentDir : string;

Returns the current working directory

 

function SetCurrentDir(value : string) : boolean;

Set the current working directory

 

function ExpandRelativePath(filepath : string; relativeto : string) : string;

Returns the full path and filename of the file specified with the relative path.

eg. ExpandRelativePath("..\..\Source", "myfile.txt") = "c:\Dev\Source\myfile.txt"

 

function NewGUIDString : string;

Creates a new GUID (Globally Unique Identifier)

 

function ExtractMajorVer(value : string) : string;

Extracts the Major Version value from a version string

eg. ExtractMajorVer("3.0.23.1") = "3"

 

function ExtractMinorVer(value : string) : string;

Extracts the Minor Version value from a version string

eg. ExtractMajorVer("3.0.23.1") = "0"

 

function ExtractReleaseVer(value : string) : string;

Extracts the Release Version value from a version string

eg. ExtractMajorVer("3.0.23.1") = "23"

 

function ExtractBuildVer(value : string) : string;

Extracts the Build Version value from a version string

eg. ExtractMajorVer("3.0.23.1") = "1"

 

function MessageBox(text : string; title : string; style : integer) : integer;

Displays a message box to the user.

See MessageBox Constants

 

procedure alert(text : string);

Displays an alert dialog to the user.

 

function EncryptString(value : String) : String;

function DecryptString(value : String) : String;

 

Two functions to scramble and descramble passwords, etc. (ie for storage in project files.)

Uses blowfish with a hardcoded key. Not to be considered secure.

 

function RunProcess...

 

Deprecated. Allows the user to launch an external process and obtain a result code when it exits.

Not recommended (use ActionStudio to create an Execute Program Action instead.)

 

procedure SetEstimatedProgressTotal(Value : Integer);

 

Use to set the estimated total number of actions (for the Build Summary estimated progress bar.)

See Estimated Progress for an example script.