Scripts Reference Summary

This summary consolidates all procedures, functions, types, and key declarations from the scripting reference into quick-reference tables.

Platform

Type Description
plWindowsIntel Windows on x86/x64 processors.
plWindowsARM Windows on ARM processors.
plMacOSIntel macOS on Intel processors.
plMacOSARM macOS on Apple Silicon/ARM processors.
plLinuxIntel Linux on x86/x64 processors.
plLinuxARM Linux on ARM processors.
plIOSARM iOS/iPadOS on ARM processors.
plAndroidARM Android on ARM processors.

Parameter Creation and Layout

Method Description
function CreateParam(caption: string; typ: TParamType, ioTyp : TParamIOType ):TParameter; Creates an inlet/outlet
TParameter.IsInput(val: Boolean) Enables the inlet port.
TParameter.IsOutput(val: Boolean) Enables the outlet port.
TParameter.Scale(val: TScale) Applies linear, logarithmic, or exponential scaling to faders.
TParameter.Color(val: TAlphaColor) Sets the foreground/ON color.
TParameter.OffColor(val: TAlphaColor) Sets the OFF color for switch-style controls.
TParameter.Visible(val: Boolean) Shows or hides the control in the module panel.
TParameter.Min(val: Single) Defines the minimum allowed value.
TParameter.Max(val: Single) Defines the maximum allowed value.
TParameter.MinMaxNoLimit(val: Boolean) Unlocks values beyond the defined min/max.
TParameter.DefaultValue(val: Single) Declares the reset/default value.
TParameter.Caption(val: String) Updates the displayed caption.
TParameter.Symbol(val: String) Adds a suffix such as ms or %.
TParameter.Format(val: String) Controls numeric formatting via Pascal format strings.
TParameter.StringValue(val: String) Assigns text to string parameters.
TParameter.ListboxString(val: String) Sets combo-box items using comma-text.
TParameter.ReadOnly(val: Boolean) Locks or unlocks user edits.
TParameter.FastCallback(val: Boolean) Toggles fast callbacks for realtime response. DEPRECATED use TParameter.CallbackMode instead
TParameter.CallbackMode(mode: TCallbackMode) Sets the thread on which the parameter's callback executes: cbMainThread, cbImmediate, cbAsync, cbVideo, cbRealTime, cbGraphic, cbNetwork
TParameter.DontSave(val: Boolean) Excludes the parameter from patch persistence.
TParameter.SavedName(val: String) Overrides the storage key used on disk.
TParameter.IsSeparator(val: Boolean) Inserts a blank row before the control in the UI.

CreateParam

Type Description
ptTextField Text field inlet/outlet.
ptColor Color picker inlet/outlet.
ptMIDI MIDI inlet/outlet.
ptGainFader Gain fader inlet/outlet (-84 to +12 dB).
ptAudio Audio inlet/outlet.
ptDataField Numeric inlet/outlet without a fader; click to edit the value.
ptDataFader Numeric inlet/outlet with a mouse-driven fader.
ptButton Momentary trigger inlet/outlet.
ptListBox Combo box inlet/outlet; populate with SetListBoxString.
ptSwitch Toggle switch inlet/outlet.
ptArray Array inlet/outlet.
ptIpAddress IPv4-formatted inlet/outlet (xxx.xxx.xxx.xxx).
ptTimecode Timecode inlet/outlet (HH:MM:SS:FF).
ptMIDINoteFader MIDI note fader inlet/outlet for notes 0..127, shown as note names.
ptPointerBitMap Hexadecimal bitmap pointer inlet/outlet.
ptPointer General hexadecimal pointer inlet/outlet.
ptLed LED-style toggle inlet/outlet (left LED layout).
ptChooseFolder Folder picker inlet/outlet.
ptRightLed LED-style toggle inlet/outlet (right LED layout).
ptTriggerLed LED trigger inlet/outlet (left LED layout).
ptFileName File picker inlet/outlet.
ptBitwise Bitwise flag inlet/outlet.
Type Description
pioInput Parameter appears as an inlet.
pioOutput Parameter appears as an outlet.
pioBoth Parameter functions as both inlet and outlet.
pioNone Parameter stays internal and is hidden on the module.

TParameter.Scale

Type Description
lsLinear Linear response; equal steps per unit.
lsLog Logarithmic response; more resolution near the minimum.
lsExp Exponential response; more resolution near the maximum.

TCallbackMode

Mode Description
cbMainThread Default. Callback runs on the main message queue (~25–50 ms). Equivalent to CallbackMode(cbMainThread).
cbImmediate Callback runs inline in the caller's thread (no queuing). Equivalent to CallbackMode(cbImmediate).
cbAsync Callback runs on the async worker thread.
cbVideo Callback runs on the video engine thread.
cbRealTime Callback runs on the dedicated real-time queue thread.
cbGraphic Callback runs during the graphic/UI refresh pass.
cbNetwork Callback runs on the network I/O thread.

Parameter Value Access

Procedure Description
procedure TParameter.asFloat(val : single); Set the value of a float parameter
function TParameter.asFloat: single; Get the value of a float parameter
procedure TParameter.asInteger(val : integer); Set the value of an integer parameter
function TParameter.asInteger: integer; Get the value of an integer parameter
procedure TParameter.asString(val : string); Set the value of a string parameter
function TParameter.asString: string; Get the value of a string parameter
procedure TParameter.asMidi(index : integer; val : TMIDI); Set the value of a MIDI parameter at the index
function TParameter.asMidi(index : integer): TMIDI; Get the value of a MIDI parameter at the index
procedure TParameter.asArray(index : integer; val : single); Set the value of a float array parameter at the index
function TParameter.asArray(index : integer): single; Get the value of a float array parameter at the index
procedure TParameter.asColor(val : TAlphaColor); Set the value of a color parameter
function TParameter.asColor: TAlphaColor; Get the value of a color parameter
procedure TParameter.asBitWise(val : uInt32); Set the value of a bitwise parameter
function TParameter.asBitWise: uInt32; Get the value of a bitwise parameter
function TParameter.asPointer: single; Returns a pointer to the value
procedure TParameter.Length(l : integer); Set the length of a parameter
function TParameter.Length: integer; Get the length of a parameter
function TParameter.equal1: boolean; Return True if the parameter’s value is equal to 1
function TParameter.equal0: boolean; Return True if the parameter’s value is equal to 0
procedure TParameter.CopyFromModule(AModuleName, AModuleTletName: string); Copy the value from a specified module terminal (inlet or outlet) into the current parameter. See dynamic-patching
procedure TParameter.CopyToModule(AModuleName, AModuleTletName: string); Copy the current parameter value to a specified module terminal (inlet or outlet). See dynamic-patching
procedure TParameter.ReadFromChunk(ChunkName, ItemName: string); Read a parameter value from a specified chunk and item. See chunks
procedure TParameter.WriteToChunk(ChunkName, ItemName: string); Write a parameter value to a specified chunk and item. See chunks

Dynamic Array

Procedure Description
procedure SetArrayLength(var A: dynamic-array; NewLength: Integer); Set the length of a dynamic array
function GetArrayLength(A: dynamic-array): Integer; Get the length of a dynamic array

Global Array

Procedure Description
function GetGlobalArraySize(name: string): integer; Get the size (number of elements) of a global array
function GetGlobalArrayFloat(name: string; index: integer): single; Get the float value of a global array element at the given index
procedure SetGlobalArrayFloat(name: string; index: integer; v: single); Set the float value of a global array element at the given index

Dynamic patching

Procedure Description
procedure SetTargetPatch(AName: string); Set the target patch where subsequent module operations will take place. If the AName is empty then the current patch containing the script is used as target
procedure CreateFileModule(Left, Top: integer; AFileName, OptionalContent, AModuleName: string); Create a new module from a file at the specified position and name, optionally providing inline content. If a module already exists with the specified AModuleName it is deleted before the creation of a new one
procedure CreateModule(numID, Left, Top, QueryIdx1, QueryIdx2: integer; AModuleName: string); Create a new module by its numeric ID and position within the patch, see module's id. If a module already exists with the specified AModuleName it is deleted before the creation of a new one
procedure DeleteModule(AName: string); Delete a module from the patch by its name
procedure CreateConnection(AModuleSrcName, AModuleSrcOutletName, AModuleTargName, AModuleTargInletName: string); Create a connection between two module terminals (source outlet → target inlet)
procedure DeleteConnection(AModuleSrcName, AModuleSrcOutletName, AModuleTargName, AModuleTargInletName: string); Delete an existing connection between two module terminals
procedure SetModuleValue(AModuleName, AModuleTletName: string; AValue: string); overload; Set a string value on a module terminal (inlet or outlet)
procedure SetModuleValue(AModuleName, AModuleTletName: string; AValue: single); overload; Set a float value on a module terminal
procedure SetModuleValue(AModuleName, AModuleTletName: string; AValue: TAlphaColor); overload; Set a color value on a module terminal
procedure SetModuleArrayValue(AModuleName, AModuleTletName: string; AValues: array of single); overload; Set multiple float values on an array-type module terminal
procedure SetModuleArrayValue(AModuleName, AModuleTletName: string; AValues: array of TAlphaColor); overload; Set multiple color values on an array-type module terminal
function GetModuleValue(AModuleName, AModuleTletName: string): TAlphaColor; overload; Get the color value of a module terminal
function GetModuleValue(AModuleName, AModuleTletName: string): single; overload; Get the float value of a module terminal
function GetModuleValue(AModuleName, AModuleTletName: string): string; overload; Get the string value of a module terminal
function GetModulesUserNamesList: string; Return a comma-separated list of all user-named modules in the current patch
procedure CopyModuleValue(AModuleName, AModuleTletName: string; AParameter: TParameter); Copy the value from a specified module terminal (inlet or outlet) into a TParameter variable
procedure CopyModuleValueToParameter(AModuleName, AModuleTletName: string; AParameter: TParameter); Copy the value from a specified module terminal (inlet or outlet) into a TParameter variable
procedure CopyParameterToModuleValue(AModuleName, AModuleTletName: string; AParameter: TParameter); Copy the value from a TParameter variable into a specified module terminal (inlet or outlet)

buses

Procedure Description
function GetBusFloat(busname: string): float; Get the current float value of the specified Usine bus
function GetBusArray(busname: string; index: integer): float; Get the float value of a specific element in a Usine bus array
procedure SetBusFloat(busname: string; v: float); Set the float value of the specified Usine bus
procedure SetBusArray(busname: string; index: integer; v: float); Set the float value of a specific element in a Usine bus array

Chunks

Procedure Description
procedure TParameter.ReadFromChunk(ChunkName, ItemName: string); Read a parameter value from a specified chunk and item
procedure TParameter.WriteToChunk(ChunkName, ItemName: string); Write a parameter value to a specified chunk and item
procedure SubscribeChunk(ChunkName, ItemName: string; CallBackID: uint32; Immediate: boolean); Subscribe to changes in a chunk item, with optional immediate callback
procedure unSubscribeAll(); Unsubscribe from all previously subscribed chunks
procedure ClearChunkItem(ChunkName, ItemName: string); Clear a specific item within a chunk
procedure ClearChunk(ChunkName: string); Clear all data within a specified chunk

Messaging and Diagnostics

Procedure Description
procedure Trace(S: string; Value: variant); Output a debug message combining a label and a value (variant type) to the Usine trace panel
procedure Trace(S: string); Output a text message to the Usine trace panel
procedure Trace(I: Integer); Output an integer value to the Usine trace panel
procedure Trace(F: Single); Output a floating-point value to the Usine trace panel

Transport Commands

Procedure Description
function GetTimecodePos: double; Gets the current Usine timecode position (in seconds or beats, depending on context)
procedure SetTimecodePos(pos: double); Sets the current Usine timecode position to the specified value

IML Messaging

Procedure Description
procedure SendUsineMsgFile(const FileName: string); Send a list of Usine messages stored in a text file
procedure SendUsineMsg(msg: string); Send a single Usine message without arguments
procedure SendUsineMsg(msg, arg1: string); Send a Usine message with one argument
procedure SendUsineMsg(msg, arg1, arg2: string); Send a Usine message with two arguments
procedure SendUsineMsg(msg, arg1, arg2, arg3: string); Send a Usine message with three arguments
procedure SendUsineMsg(msg, arg1, arg2, arg3, arg4: string); Send a Usine message with four arguments
procedure SendUsineMsg(msg, arg1, arg2, arg3, arg4, arg6: string); Send a Usine message with five arguments (note: arg6 may be a typo for arg5)
function GetUsineVariableString(name: string): string; Retrieve the value of a Usine variable as a string
function GetUsineVariableInteger(name: string): integer; Retrieve the value of a Usine variable as an integer
function GetUsineVariableFloat(name: string): double; Retrieve the value of a Usine variable as a floating-point number

TStringList

Procedure Description
function TStringList.Create: TStringList; Create a new instance of a string list
function TStringList.GetCommaText: String; Return all strings as a single comma-separated string
procedure TStringList.SetCommaText(Comma: string); Set the list contents from a comma-separated string
function TStringList.GetText: String; Return all strings concatenated with line breaks
procedure TStringList.SetText(Text: string); Replace the list contents with text split by line breaks
procedure TStringList.Sort; Sort the list in ascending order
procedure TStringList.SortDesc; Sort the list in descending order
procedure TStringList.SaveToFile(FileName: string); Save the list contents to a file. If no path is given, defaults to the last used location in Usine
procedure TStringList.AppendToFile(FileName: string); Append the list contents to the end of an existing file
procedure TStringList.LoadFromFile(FileName: string); Load list contents from a file. If no path is given, defaults to the last used location in Usine
procedure TStringList.Clear; Clear all strings from the list
procedure TStringList.Free; Free the memory allocated for the list
function TStringList.GetStrings(Index: integer): String; Get the string at the specified index
procedure TStringList.SetStrings(Index: integer; Value: String); Set the string value at the specified index
procedure TStringList.Add(Value: String); Add a new string to the end of the list
procedure TStringList.Delete(Index: integer); Delete the string at the specified index
procedure TStringList.Delete(Value: integer); Delete the string matching the specified value if it exists
function TStringList.IndexOf(Value: string): integer; Return the index of the specified string, or -1 if not found
function TStringList.Count: integer; Return the number of strings in the list
function TStringList.GetCount: integer; Same as Count; return the total number of strings in the list

TJson

Procedure Description
function TJson.Create: TJson; Create an empty JSON document (root is an empty object)
procedure TJson.Free; Release the document and all its children
procedure TJson.Clear; Reset the document to an empty object
function TJson.Parse(s: string): Boolean; Parse s into the document; returns True on success
function TJson.AsText: string; Serialise the current document back to a compact JSON string
procedure TJson.SaveToFile(FileName: string); Save the document to disk as UTF-8 JSON
function TJson.LoadFromFile(FileName: string): Boolean; Load a JSON file into the document; returns True on success
function TJson.Has(path: string): Boolean; True if a value exists at path
function TJson.Count(path: string): integer; Number of items in an array or members in an object at path
function TJson.Count: integer; Same, for the root document
function TJson.IsArray(path: string): Boolean; True if the node at path is an array
function TJson.IsObject(path: string): Boolean; True if the node at path is an object
function TJson.GetString(path: string): string; Read a string value at path (default: '')
function TJson.GetFloat(path: string): single; Read a numeric value as a float (default: 0)
function TJson.GetInt(path: string): integer; Read a numeric value as an integer (default: 0)
function TJson.GetBool(path: string): Boolean; Read a boolean value at path (default: False)
procedure TJson.SetString(path: string; val: string); Set a string at path, creating missing parents
procedure TJson.SetFloat(path: string; val: single); Set a numeric (float) value at path
procedure TJson.SetInt(path: string; val: integer); Set a numeric (integer) value at path
procedure TJson.SetBool(path: string; val: Boolean); Set a boolean value at path
procedure TJson.SetNull(path: string); Set a JSON null value at path
procedure TJson.SetObject(path: string); Create an empty object at path
procedure TJson.SetArray(path: string); Create an empty array at path
procedure TJson.Remove(path: string); Delete the field or array element at path
procedure TJson.ArrayAddString(path: string; val: string); Append a string element to the array at path
procedure TJson.ArrayAddFloat(path: string; val: single); Append a float element to the array at path
procedure TJson.ArrayAddInt(path: string; val: integer); Append an integer element to the array at path
procedure TJson.ArrayAddBool(path: string; val: Boolean); Append a boolean element to the array at path
procedure TJson.Keys(path: string; resultList: TStringList); Fill resultList with the keys of the object at path

Math and Randomization

Procedure Description
function minS(const A, B: single): single; Return the smaller of two single-precision floating-point values
function maxS(const A, B: single): single; Return the larger of two single-precision floating-point values
function maxI(const A, B: integer): integer; Return the larger of two integer values
function minI(const A, B: integer): integer; Return the smaller of two integer values
function Pi: Extended; Return the mathematical constant π
function Log(e: Extended): Extended; Return the natural logarithm of e
function Exp(e: Extended): Extended; Return e raised to the power of e
function Arctan(e: Extended): Extended; Return the arctangent of e
function Arcsin(e: Extended): Extended; Return the arcsine of e
function Arccos(e: Extended): Extended; Return the arccosine of e
function Abs(d: Extended): Extended; Return the absolute value of an extended value
function Abs(d: Int64): Int64; Return the absolute value of an integer
function Power(Base, Exponent: Extended): Extended; Return Base raised to the power of Exponent
function Sqr(d: Extended): Extended; Return the square of a number
function Sqrt(d: Extended): Extended; Return the square root of a number
function ArcTan(d: Extended): Extended; Return the arctangent of d
function Ln(d: Extended): Extended; Return the natural logarithm of d
function Sin(d: Extended): Extended; Return the sine of an angle
function Cos(d: Extended): Extended; Return the cosine of an angle
function Exp(d: Extended): Extended; Return e raised to the power of d
function Round(d: Extended): Int64; Round a floating-point value to the nearest integer
function Round(d: Extended; Precision: Int8): Extended; Round a floating-point value to a specified decimal precision
function Frac(d: Extended): Extended; Return the fractional part of a number
function Int(d: Extended): Extended; Return the integer part of a number
function Trunc(d: Extended): Int64; Truncate the fractional part of a number
function Ceil(d: Extended): Int64; Return the smallest integer greater than or equal to d
function Floor(d: Extended): Int64; Return the largest integer less than or equal to d
function Random(Min, Max: Int64): Int64; Return a random integer between Min and Max
function Random(l: Int64): Int64; Return a random integer from 0 to l - 1
function Random: Extended; Return a random floating-point number between 0.0 and 1.0
procedure Randomize; Initialize the random number generator with a new seed

Date & Time

Procedure Description
var HoursPerDay Number of hours in a day
var MinsPerHour Number of minutes in an hour
var SecsPerMin Number of seconds in a minute
var MSecsPerSec Number of milliseconds in a second
var MinsPerDay Number of minutes in a day
var SecsPerDay Number of seconds in a day
var MSecsPerDay Number of milliseconds in a day
var DateDelta Offset between Delphi’s TDateTime base date and Unix epoch
type TDateTime: double; Represents both date and time as a floating-point value
type TTime: double; Represents only time as a floating-point value
function EncodeDate(Year, Month, Day: UInt16): TDateTime; Create a TDateTime value from year, month, and day
function EncodeTime(Hour, Min, Sec, MSec: UInt16): TDateTime; Create a TDateTime value from hour, minute, second, and millisecond
procedure DecodeDate(DateTime: TDateTime; var Year, Month, Day: UInt16); Extract year, month, and day from a TDateTime value
function DecodeDateFully(DateTime: TDateTime; var Year, Month, Day, DOW: UInt16): Boolean; Decode a TDateTime and return the day of week as well
procedure DecodeTime(DateTime: TDateTime; var Hour, Min, Sec, MSec: UInt16); Extract time components from a TDateTime value
function Date: TDateTime; Return the current system date
function Time: TDateTime; Return the current system time
function Now: TDateTime; Return the current system date and time
function GetTickCount: UInt32; Return the number of milliseconds since system start
procedure Sleep(MilliSeconds: UInt32); Pause execution for a specified number of milliseconds
procedure ReplaceTime(var DateTime: TDateTime; NewTime: TDateTime); Replace the time portion of a TDateTime value
procedure ReplaceDate(var DateTime: TDateTime; NewDate: TDateTime); Replace the date portion of a TDateTime value
function DateTimeInRange(ADateTime: TDateTime; AStartDateTime, AEndDateTime: TDateTime): Boolean; Check if a TDateTime lies within a given range
function FormatDateTime(Format: string; DateTime: TDateTime): string; Return a formatted string representation of a date/time value
function StrToDate(s: string): TDateTime; Convert a string to a date
function StrToDateDef(s: string; Default: TDateTime): TDateTime; Convert a string to a date, returning a default on error
function StrToTime(s: string): TDateTime; Convert a string to a time
function StrToTimeDef(s: string; Default: TDateTime): TDateTime; Convert a string to a time, returning a default on error
function StrToDateTime(s: string): TDateTime; Convert a string to a combined date/time
function StrToDateTimeDef(s: string; Default: TDateTime): TDateTime; Convert a string to a combined date/time, returning a default on error

Files

Procedure Description
function GetApplicationPath: string; Return the absolute path of the current Usine application folder
procedure FindFiles(const Directory: String; Extensions: String; Recursive: Boolean; Result: TStringList); Find all files in a directory matching specific extensions (e.g. 'pat,wkp'), optionally searching recursively
procedure FindDirectories(const Directory: String; Recursive: Boolean; Result: TStringList); Find all subdirectories within a directory, optionally recursively
function WriteFileContents(const FileName: String; const Text: String; Append: Boolean): Boolean; Write text to a file, optionally appending to existing content
function ReadFileContents(const FileName: String): String; Read the contents of a text file and return as string
function CreateDirectory(const Directory: String): Boolean; Create a single-level directory
function ForceDirectories(const Directory: String): Boolean; Create a full directory path, including intermediate directories
function DeleteDirectory(const Directory: String; OnlyChildren: Boolean): Boolean; Delete a directory or only its contents
function DeleteFile(const FileName: String): Boolean; Delete a specified file
function RenameFile(const OldFileName, NewFileName: String): Boolean; Rename or move a file
function CopyFile(const SourceFileName, DestFileName: String; Overwrite: Boolean = False): Boolean; Copy a file, optionally overwriting an existing one
function FileExists(const FileName: String): Boolean; Check whether a file exists
function DirectoryExists(const Directory: String): Boolean; Check whether a directory exists
function FileAge(const FileName: String): Int32; overload; Get the modification date/time of a file as an integer timestamp
function FileAge(const FileName: String; out FileDateTime: TDateTime): Boolean; overload; Get the modification date/time of a file as a TDateTime value
function ExtractFilePath(const FileName: String): String; Extract the directory path from a full file name
function ExtractFileDrive(const FileName: String): String; Extract the drive or volume from a file path
function ExtractFileName(const FileName: String): String; Extract the file name (without path) from a full path
function ExtractFileExt(const FileName: String): String; Extract the file extension from a file name
function ExtractFileDir(const FileName: String): String; Extract the directory portion of a full path
function ExpandFileName(const FileName: String): String; Convert a relative path into an absolute path
function ExtractRelativePath(const BaseName, DestName: String): String; Compute the relative path from one directory to another
function IncludeTrailingPathDelimiter(const Path: String): String; Ensure a path ends with the correct path delimiter
function ExcludeTrailingPathDelimiter(const Path: String): String; Remove the trailing path delimiter from a path
function IncludeTrailingBackslash(const Path: String): String; Ensure a path ends with a backslash (\)
function ExcludeTrailingBackslash(const Path: String): String; Remove a trailing backslash from a path
function IncludeLeadingPathDelimiter(const Path: String): String; Ensure a path starts with a path delimiter
function ExcludeLeadingPathDelimiter(const Path: String): String; Remove a leading path delimiter from a path
function SubFileExt(FileName: String): string; Return the file name without its extension
function PathDelim: string; Return the platform-specific path delimiter ('/' on macOS, '\\' on Windows)
procedure CreateDir(Dir: String); Create a directory (legacy compatibility version)

Strings

Procedure Description
type TTextLineBreakStyle = (tlbsLF, tlbsCRLF, tlbsCR); Defines possible line break styles (Line Feed, Carriage Return + Line Feed, Carriage Return)
type TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase); Flags used for string replacement options
function UpperCase(s: string): string; Convert all characters in a string to uppercase
function LowerCase(s: string): string; Convert all characters in a string to lowercase
function UpCase(c: AnsiChar): AnsiChar; Convert a single ANSI character to uppercase
function UpCase(c: WideChar): WideChar; Convert a single wide character to uppercase
function CompareStr(s1, s2: string): Int32; Compare two strings case-sensitively
function CompareMem(p1, p2: Pointer; Length: PtrUInt): EvalBool; Compare two memory blocks for equality
function CompareText(s1, s2: string): Int32; Compare two strings ignoring case
function SameText(s1, s2: string): EvalBool; Return True if two strings are equal ignoring case
function Copy(s: string; ifrom, icount: Longint): string; Copy a substring from a string
procedure Delete(var s: string; ifrom, icount: Longint); Delete a substring from a string
procedure Insert(s: string; var s2: string; ipos: Longint): string; Insert a substring into another string at a given position
function StrGet(var S: String; i: Integer): Char; Get the character at index i in a string
procedure StrSet(c: Char; I: Integer; var s: String); Set a specific character in a string at position I
function Length(s: String): Longint; Return the number of characters in a string
procedure SetLength(var S: String; L: Longint); Set the length of a string
function AnsiUpperCase(s: string): string; Convert a string to uppercase using locale-specific rules
function AnsiLowerCase(s: string): string; Convert a string to lowercase using locale-specific rules
function AnsiCompareStr(s1, s2: string): Int32; Compare two strings case-sensitively using ANSI rules
function AnsiCompareText(s1, s2: string): Int32; Compare two strings case-insensitively using ANSI rules
function AnsiSameText(s1, s2: String): EvalBool; Return True if two strings are equal ignoring case (ANSI version)
function AnsiSameStr(s1, s2: String): EvalBool; Return True if two strings are exactly equal (ANSI version)
function Trim(s: string): string; Remove leading and trailing spaces from a string
function TrimLeft(s: string): string; Remove leading spaces from a string
function TrimRight(s: string): string; Remove trailing spaces from a string
function PadL(s: string; Len: SizeInt; c: Char = ' '): string; Pad a string on the left to a given length using the specified character
function PadR(s: string; Len: SizeInt; c: Char = ' '): string; Pad a string on the right to a given length using the specified character
function Padz(s: string; I: LongInt): string; Pad a string on the left with zeros instead of spaces
function QuotedStr(s: string): string; Return a quoted version of a string
function AnsiQuotedStr(s: string; Quote: Char): string; Return a string enclosed by a specific quote character
function AnsiDequotedStr(s: string; AQuote: Char): string; Remove quotes from a quoted string
function WrapText(Line, BreakStr: string; BreakChars: set of AnsiChar; MaxCol: Int32): string; Wrap a text line into multiple lines based on maximum column width
function AdjustLineBreaks(s: string; Style: TTextLineBreakStyle): string; Convert line breaks to a given line break style
function IntToHex(Value: Int64; Digits: Int32 = 1): string; Convert an integer value to a hexadecimal string
function IntToHex(Value: UInt64; Digits: Int32 = 1): string; Convert an unsigned integer value to a hexadecimal string
function IntToStr(i: Int64): string; Convert an integer to its string representation
function IntToStr(i: UInt64): string; Convert an unsigned integer to its string representation
function StrToInt(s: string): Int32; Convert a string to an integer
function StrToIntDef(s: string; Def: Int32): Int32; Convert a string to an integer, returning a default value on error
function StrToInt64(s: string): Int64; Convert a string to a 64-bit integer
function StrToInt64Def(s: string; Def: Int64): Int64; Convert a string to a 64-bit integer, returning a default on error
function StrToUInt64(s: string): UInt64; Convert a string to an unsigned 64-bit integer
function StrToUInt64Def(s: string; Def: UInt64): UInt64; Convert a string to an unsigned 64-bit integer, returning a default on error
function FloatToStr(f: Extended): string; Convert a floating-point value to a string
function StrToFloat(s: string): Extended; Convert a string to a floating-point value
function StrToFloatDef(s: string; Def: Extended): Extended; Convert a string to a float, returning a default value on error
function CurrToStr(Value: Currency): string; Convert a currency value to a string
function StrToCurr(s: string): Currency; Convert a string to a currency value
function StrToCurrDef(s: string; Def: Currency): Currency; Convert a string to a currency value, returning a default on error
function StrToBool(s: string): EvalBool; Convert a string to a boolean value
function BoolToStr(B: EvalBool; TrueS: string = 'True'; FalseS: string = 'False'): string; Convert a boolean value to its string representation
function StrToBoolDef(s: string; Default: EvalBool): EvalBool; Convert a string to a boolean value, returning a default on error
function Format(Fmt: string; Args: array of Variant): string; Format a string using placeholders and argument values
function FormatFloat(Format: string; Value: Extended): string; Format a floating-point value according to a format string
function FormatCurr(Format: string; Value: Currency): string; Format a currency value according to a format string
function LastDelimiter(Delimiters, s: string): SizeInt; Return the position of the last delimiter character in a string
function StringReplace(S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string; Replace occurrences of a substring within a string using flags for case and repetition
function IsDelimiter(Delimiters, s: string; Index: SizeInt): EvalBool; Check if a character at a given position is one of the specified delimiters
function Pos(Substr: string; Source: string): SizeInt; Return the position of a substring within another string
function StringOfChar(c: Char; l: SizeInt): string; Create a string made of the same character repeated l times
function Replicate(c: Char; I: LongInt): string; Build a string containing I repetitions of a character

String helpers

Procedure Description
function string.StartsWith(AValue: string): boolean; Return True if the string begins with the specified substring AValue
function string.EndsWith(AValue: string): boolean; Return True if the string ends with the specified substring AValue

Color helpers

Procedure Description
function TAlphaColor.A: integer; overload; Get the alpha (transparency) component of the color
procedure TAlphaColor.A(V: integer); overload; Set the alpha (transparency) component of the color
function TAlphaColor.R: integer; overload; Get the red component of the color
procedure TAlphaColor.R(V: integer); overload; Set the red component of the color
function TAlphaColor.G: integer; overload; Get the green component of the color
procedure TAlphaColor.G(V: integer); overload; Set the green component of the color
function TAlphaColor.B: integer; overload; Get the blue component of the color
procedure TAlphaColor.B(V: integer); overload; Set the blue component of the color

windows registry

Procedure Description
procedure WriteRegistryInteger(AKey, AName: string; AValue: integer); Write an integer value to the Windows registry under the specified key and name
procedure WriteRegistryString(AKey, AName: string; AValue: string); Write a string value to the Windows registry under the specified key and name
function ReadRegistryInteger(AKey, AName: string): integer; Read an integer value from the Windows registry for the specified key and name
function ReadRegistryString(AKey, AName: string): string; Read a string value from the Windows registry for the specified key and name

variants

Type Description
varEmpty The variant is unassigned
varNull The variant is Null
varAny A variant that can hold any value
varSmallint 16-bit signed integer (Smallint in Delphi, short in C++)
varInteger 32-bit signed integer (Integer in Delphi, int in C++)
varSingle Single-precision floating-point value (Single in Delphi, float in C++)
varDouble Double-precision floating-point value (Double)
varCurrency Currency floating-point value (Currency)
varDate Date and time value (TDateTime)
varOleStr Reference to a dynamically allocated UNICODE string
varDispatch Reference to an Automation object (IDispatch pointer)
varError Operating system error code
varBoolean 16-bit Boolean (WordBool)
varVariant Indicates another variant
varUnknown Reference to an unknown object (IUnknown or IInterface pointer)
varShortInt 8-bit signed integer (ShortInt or signed char)
varByte 8-bit unsigned byte
varWord Unsigned 16-bit value (Word)
varLongWord Unsigned 32-bit value (LongWord or unsigned long)
varInt64 64-bit signed integer (Int64 or __int64)
varStrArg COM-compatible string
varString Reference to a dynamically allocated non-COM string
varArray Indicates a Variant array
varByRef Indicates the variant contains a reference instead of a value
varTypeMask Type mask for array elements
Procedures
Procedure Description
function VarType(const V: Variant): TVarType; Return the type code of a variant
function VarAsType(const V: Variant; aVarType: TVarType): Variant; Convert a variant to a specific variant type
function VarIsByRef(const V: Variant): EvalBool; Return True if the variant contains a reference
function VarIsEmpty(const V: Variant): EvalBool; Return True if the variant is unassigned
function VarIsNull(const V: Variant): EvalBool; Return True if the variant is Null
function VarIsClear(const V: Variant): EvalBool; Return True if the variant is cleared or uninitialized
function VarIsError(const V: Variant; out AResult: HRESULT): EvalBool; Return True if the variant contains an error value
function VarAsError(AResult: HRESULT): Variant; Create a variant representing a COM error code
function VarIsCustom(const V: Variant): EvalBool; Return True if the variant is of a custom (user-defined) type
function VarIsOrdinal(const V: Variant): EvalBool; Return True if the variant contains an ordinal (integer-like) type
function VarIsFloat(const V: Variant): EvalBool; Return True if the variant contains a floating-point number
function VarIsNumeric(const V: Variant): EvalBool; Return True if the variant contains a numeric type
function VarIsStr(const V: Variant): EvalBool; Return True if the variant contains a string
function VarIsArray(const A: Variant; AResolveByRef: EvalBool = True): EvalBool; Return True if the variant is an array
function VarToStr(const V: Variant): string; Convert a variant to a string
function VarToStrDef(const V: Variant; ADefault: string): string; Convert a variant to a string, returning a default if invalid
function VarToWideStr(const V: Variant): WideString; Convert a variant to a WideString
function VarToWideStrDef(const V: Variant; ADefault: WideString): WideString; Convert a variant to a WideString with default value
function VarToUnicodeStr(const V: Variant): UnicodeString; Convert a variant to a UnicodeString
function VarToUnicodeStrDef(const V: Variant; ADefault: UnicodeString): UnicodeString; Convert a variant to a UnicodeString with default value
function VarToDateTime(const V: Variant): TDateTime; Convert a variant to a TDateTime
function VarFromDateTime(DateTime: TDateTime): Variant; Convert a TDateTime to a variant
function VarInRange(const AValue, AMin, AMax: Variant): EvalBool; Return True if a variant value is within a range
function VarEnsureRange(const AValue, AMin, AMax: Variant): Variant; Clamp a variant to a specified range
function VarSameValue(const A, B: Variant): EvalBool; Return True if two variants have the same value
function VarCompareValue(const A, B: Variant): TVariantRelationship; Compare two variants and return their relationship
function VarTypeIsValidArrayType(aVarType: TVarType): EvalBool; Return True if the type can be used as an array type
function VarTypeIsValidElementType(aVarType: TVarType): EvalBool; Return True if the type can be used as an element type in a variant array
function VarArrayCreate(Bounds: array of SizeInt; aVarType: TVarType): Variant; Create a variant array of the given bounds and element type
function VarArrayOf(Values: array of Variant): Variant; Create a variant array initialized with given values
procedure VarArrayRedim(var A: Variant; HighBound: SizeInt); Change the upper bound of the last dimension in a variant array
function VarArrayAsPSafeArray(const A: Variant): Pointer; Return a pointer to the SAFEARRAY representing the variant array
procedure VarCopyNoInd(var Dest: Variant; const Source: Variant); Copy a variant value without dereferencing references
function VarArrayDimCount(const A: Variant): SizeInt; Return the number of dimensions in a variant array
function VarArrayLowBound(const A: Variant; Dim: SizeInt): SizeInt; Return the lower bound of a specified array dimension
function VarArrayHighBound(const A: Variant; Dim: SizeInt): SizeInt; Return the upper bound of a specified array dimension
function VarArrayLock(const A: Variant): Pointer; Lock a variant array and return a pointer to its data
procedure VarArrayUnlock(const A: Variant); Unlock a previously locked variant array
function VarArrayRef(const A: Variant): Variant; Return a reference to a variant array
function VarArrayGet(const A: Variant; Indices: array of Int32): Variant; Retrieve an element from a variant array by index
procedure VarArraySet(var A: Variant; const Value: Variant; Indices: array of Int32); Assign a value to a variant array element by index
Constants
Constant Value Description
S_OK 0 No error, the operation succeeded (often interpreted as True)
S_FALSE $00000001 No error, but the operation did not produce a meaningful result (often interpreted as False)
E_NOINTERFACE $80004002 The requested interface is not supported by the object
E_UNEXPECTED $8000FFFF Catastrophic or unexpected failure
E_NOTIMPL $80004001 Operation not implemented

version 7.0.250121

Edit All Pages