Global Scripting Functions
Apart from standard VBScript/JavaScript/PowerShell functions, FinalBuilder exposes the following global functions:
Method Call | Example | Description |
---|---|---|
procedure SaveProject; | SaveProject(); | Saves the current FinalBuilder project. |
function ExtractFilePath(filename : string) : string; | var path = ExtractFilePath('C:\\Temp\\TextFile.txt'); // path == 'C:\Temp\' | Extracts the path (minus the filename) from a fully qualified filename. The trailing backslash will be included in the returned string. |
function ExtractFilename(filename : string) : string; | var filename = ExtractFilename('C:\\Temp\\TextFile.txt'); // filename == 'TextFile.txt' | Extracts the FileName (minus the path) from a fully qualified filename. |
function ExtractFileDrive(filename : string) : string; | var drive = ExtractFileDrive('C:\\Temp\\TextFile.txt'); // drive == 'C:' | Extracts the filename drive letter. No trailing backslash is included in the returned string. |
function ExtractFileExt(filename : string) : string; | var ext = ExtractFileExt('C:\\Temp\\TextFile.txt'); // ext == '.txt' | Extracts the file extension including the period. |
function ExpandUNCFilename(filename: string) : string; | var unc = ExpandUNCFilename('C:\\Temp\\TextFile.txt'); // unc == '\\Server\Temp\TextFile.txt' var local = ExpandUNCFilename('\\\\Server\\Temp\\TextFile.txt'); // unc == 'C:\Temp\TextFile.txt' | Expands any pathname to either the fully qualified UNC pathname or the fully qualified local pathname. |
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. | |
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. |