List of VBScript functions

From StealthBot Wiki Backup
Revision as of 05:49, 7 April 2016 by Ribose (talk) (CreateObject function)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

These are all of the methods available by default to the VBScript language.

Arguments in bold are required while arguments in [italics and brackets] are optional and may be omitted. Optional arguments may be set to equal something in the syntax: this is their default value if you did not pass another value (Example: [FirstDayOfWeek = vbSunday] means the first-day-of-week argument will default to Sunday if not provided).

This reference shows all functions with arguments in parentheses and assign the return value to a variable indicating its Variant type. Refer to the correct calling syntax for any of the methods below you wish to use.

Contents

Array methods

These functions allow you to interact with VBScript arrays.

Array function

Syntax:

Arr = Array(Element1, Element2, Element3, ...)

This function returns an array containing the elements provided to the function. You can pass no arguments to create an empty array.

Note: Arrays are 0-based so Element1 above will be in Arr(0).

Filter function

Syntax:

NewArr = Filter(Arr, Match, [Include = True],
[CompareMode = vbBinaryCompare])

This function returns a new array containing only the elements from Arr that match the criteria. If Include is True, all elements that contain the Match string value will be returned. If Include is False, all elements that do not contain the Match string value will be returned. Specify the string compare mode with CompareMode.

IsArray function

Syntax:

BoolVal = IsArray(Arr)

This function returns True if Arr is an array. If it is not, False is returned.

Join function

Syntax:

StringVal = Join(Arr, [Delimiter = " "])

This function returns a string containing all of the elements of the array Arr, separated by the Delimiter string.

LBound function

Syntax:

NumberVal = LBound(Arr, [Dimension = 1])

This function returns the lowest index (lower bound) of an array. Specify which dimension of the array to get the lower bound from with Dimension. In almost all cases, this will return 0.

Split function

Syntax:

ArrVal = Split(Str, [Delimiter = " "], [Count = -1],
[CompareMode = vbBinaryCompare])

This function splits up the string Str and returns an array of strings. It is split wherever there is a Delimiter string found. If Count is set to -1, the string will be split as many times as there are Delimiters in it. If Count is lower than the amount of Delimiters, then the string will be split only Count times and the remaining string with delimiters will be left in the upper-bound index of the array. If Count is greater than the amount of Delimiters, the array will be only as big as the amount of Delimiters.

Examples:

s = "Hello, there my name is Bob."
a = Split(s, " ")

a is Array( "Hello,", "there", "my", "name", "is", "Bob." )

a = Split(s, " ", 3)

a is Array( "Hello,", "there", "my name is Bob." )

Note: the upper-bound is deceptively 2 even though the Count is 3.

a = Split(s, ", ", 3)

a is Array( "Hello", "there my name is Bob." )

Note: the upper-bound is 1 even though if you didn't know the string you might expect 2. There weren't enough ", " sequences for 3 parts.

Specify the string compare mode with CompareMode.

UBound function

Syntax:

NumberVal = UBound(Arr, [Dimension = 1])

This function returns the highest index (upper bound) of an array. Specify which dimension of the array to get the upper bound from with Dimension.

Note: UBound() returns the number of elements in the array minus one because arrays are zero-based.

Conversion and type methods

These convert from one value type to another, or do actions based on variable type or convertibility. Some of these functions can be found in the section relating to their type.

Asc function

Syntax:

NumberVal = Asc(Character)

Returns the "ANSI code" value of the provided character. If the provided string has more than one character, only the first will be used.

Example: The ANSI code for the "A" character is 65, for "a" is 97, for " " is 32, and for quote (") is 34.

CBool function

Syntax:

BoolVal = CBool(Value)

Returns the provided Value as a Boolean type.

Notes: The number 0 results in False and any other number results in True. Only the strings "True" (case-insensitive) or "False" convert to Boolean. If not convertible, a run-time error occurs.

CByte function

Syntax:

ByteVal = CByte(Value)

Returns the provided Value as a numeric byte type. There is no literal value for byte, so this function is the most common way to retrieve a value of the type.

Note: Use the IsNumeric() function to check whether the value can be converted to a number type. If not convertible, a run-time error occurs. If out of rage (0 to 255), an overflow run-error occurs.

CCur function

Syntax:

CurVal = CCur(Value)

Returns the provided Value as a numeric currency type. There is no literal value for currency, so this function is the most common way to retrieve a value of the type.

Note: Use the IsNumeric() function to check whether the value can be converted to a number type. If not convertible, a run-time error occurs.

CDate function

Syntax:

DateVal = CDate(Value)

Converts the specified value to a date type and returns the date.

Note: Use the IsDate() function to check whether the value is a valid date string or other value before attempting to convert it. If it is not, an error will be raised.

CDbl function

Syntax:

DblVal = CDbl(Value)

Converts the specified value to a double type and returns the double.

Note: Use the IsNumeric() function to check whether the value can be converted to a number type. If not convertible, a run-time error occurs.

Chr function

Syntax:

StringVal = Chr(ANSI)

Returns the character for the provided "ANSI code" value. The value must be a valid byte (0 to 255).

Example: The character for the ANSI code 65 is the "A" character, for 97 is "a", for 32 is " ", and for 34 is quote (").

CInt function

Syntax:

IntVal = CInt(Value)

Converts the specified value to an integer type and returns the integer.

Note: Use the IsNumeric() function to check whether the value can be converted to a number type. If not convertible, a run-time error occurs.

CLng function

Syntax:

LngVal = CLng(Value)

Converts the specified value to a long integer type and returns the long.

Note: Use the IsNumeric() function to check whether the value can be converted to a number type. If not convertible, a run-time error occurs.

CSng function

Syntax:

SngVal = CSng(Value)

Converts the specified value to a single type and returns the single. There is no literal value for single, so this function is the most common way to retrieve a value of the type.

Note: Use the IsNumeric() function to check whether the value can be converted to a number type. If not convertible, a run-time error occurs.

CStr function

Syntax:

StringVal = CStr(Value)

Converts the specified value to a string type and returns the string.

Note: Most values except types of objects can be converted to a string.

Hex function

Syntax:

StringVal = Hex(Number)

Returns the provided Number as a hexadecimal (base-16) number in a string.

IsArray function

Syntax:

BoolVal = IsArray(Arr)

This function returns True if Arr is an array. If it is not, False is returned.

IsDate function

Syntax:

BoolVal = IsDate(Value)

Returns True when the Value can be converted to a date or is a date. Returns False if the conversion would result in an error.

IsEmpty function

Syntax:

BoolVal = IsEmpty(Variable)

Returns True when the Variable has not been assigned a value, or is Empty.

IsNull function

Syntax:

BoolVal = IsNull(Variable)

Returns True when the Variable is Null.

IsNumeric function

Syntax:

BoolVal = IsNumeric(Value)

Returns True when the Value a numeric type. Returns False if a conversion to a numeric type would result in an error.

IsObject function

Syntax:

BoolVal = IsObject(Variable)

Returns True when the Variable references an object.

Oct function

Syntax:

StringVal = Oct(Number)

Returns the provided Number as an octal (base-8) number in a string.

TypeName function

Syntax:

StringVal = TypeName(Variable)

Returns the name of the type of variable that Variable contains. For some objects, this function returns a string other than "Object".

VarType function

Syntax:

NumberVal = VarType(Variable)

Returns the type of variable that Variable contains. The result is one of the variable type constants.

Date and time methods

These methods deal with dates and times, and specifically the date value type.

CDate function

Syntax:

DateVal = CDate(Value)

Converts the specified value to a date type and returns the date.

Note: Use the IsDate() function to check whether the value is a valid date string or other value before attempting to convert it. If it is not, an error will be raised.

Date function

Syntax:

DateVal = Date()

Returns the current system date as a date type.

DateAdd function

Syntax:

DateVal = DateAdd(DateInterval, Number, DateValue)

Adds a specified amount of time to the provided DateValue and returns the value as another date.

Note: Number is the amount and DateInterval is a date interval string representing the units of the Number to add to the provided DateValue. Number can be positive (to return future dates from the original) or negative (to return past dates).

Date intervals

Date intervals specify the "unit" of time added to the date.

The valid string values of a date interval argument (there are no constants defined for these, but you may define them):

  • "yyyy" - Year
  • "q" - Quarter
  • "m" - Month
  • "y" - Day of year
  • "d" - Day
  • "w" - Weekday
  • "ww" - Week of year
  • "h" - Hour
  • "n" - Minute
  • "s" - Second

DateDiff function

Syntax:

NumberVal = DateDiff(DateInterval, Date1, Date2,
[FirstDayOfWeek = vbSunday], [FirstWeekOfYear = vbFirstJan1])

Returns a numeric value which is the amount of DateIntervals between the two provided dates. The optional FirstDayOfWeek and FirstWeekOfYear values allow you to fine-tune your result based on the first day of week settings and the first week of year settings.

Notes: DateInterval is a date interval string representing the units of the result that will be returned. The result can be positive (Date1 is before of Date2), negative (Date1 is after Date2), or zero (Date1 equals Date2 to the precision of the DateInterval).

Date intervals

Date intervals specify the "unit" of time returned from the difference of two dates.

The valid string values of a date interval argument (there are no constants defined for these, but you may define them):

  • "yyyy" - Year
  • "q" - Quarter
  • "m" - Month
  • "y" - Day of year
  • "d" - Day
  • "w" - Weekday
  • "ww" - Week of year
  • "h" - Hour
  • "n" - Minute
  • "s" - Second

DatePart function

Syntax:

NumberVal = DatePart(DateInterval, Date,
[FirstDayOfWeek = vbSunday], [FirstWeekOfYear = vbFirstJan1])

Returns a numeric value which is the amount of DateIntervals in the provided Date. The optional FirstDayOfWeek and FirstWeekOfYear values allow you to fine-tune your result based on the first day of week settings and the first week of year settings.

Note: DateInterval is a date interval string representing the units of the result that will be returned.

Date intervals

Date intervals specify the "unit" of time part returned from a date.

The valid string values of a date interval argument (there are no constants defined for these, but you may define them):

  • "yyyy" - Year
  • "q" - Quarter
  • "m" - Month
  • "y" - Day of year
  • "d" - Day
  • "w" - Weekday
  • "ww" - Week of year
  • "h" - Hour
  • "n" - Minute
  • "s" - Second

DateSerial function

Syntax:

DateVal = DateSerial(Year, Month, Day)

Returns a date value for the specified Day, Month, and Year.

Note: Use this instead of a date literal if some of the parts of the date require calculations.

DateValue function

Syntax:

DateVal = DateValue(Date)

Returns a date value for the specified Date. This will convert to date, like the CDate() function, but time parts of the date will be removed.

Note: A run-time error will occur if the value provided is not parse-able.

Day function

Syntax:

NumberVal = Day(Date)

Returns the numeric day of the month of the specified Date, from 1 to 31.

FormatDateTime function

Syntax:

StringVal = FormatDateTime(Date, Format)

Returns a string version of the specified Date formatted according to the date format constant specified in Format.

Hour function

Syntax:

NumberVal = Hour(Time)

Returns the numeric hour of the day of the specified Time date value, from 0 to 23.

IsDate function

Syntax:

BoolVal = IsDate(Value)

Returns True when the Value can be converted to a date or is a date. Returns False if the conversion would result in an error.

Minute function

Syntax:

NumberVal = Minute(Time)

Returns the numeric minute of the hour of the specified Time date value, from 0 to 59.

Month function

Syntax:

NumberVal = Month(Date)

Returns the numeric month of the year of the specified Date, from 1 to 12.

MonthName function

Syntax:

StringVal = Month(Month, [Abbreviate = False])

Returns the full name of the month of the specified numeric Month. If Abbreviate is set to True, the three-letter month abbreviation will be returned instead.

Note: Month must be from 1 to 12.

Now function

Syntax:

DateVal = Now()

Returns the current system date and time as a date type.

Second function

Syntax:

NumberVal = Second(Time)

Returns the numeric second of the minute of the specified Time date value, from 0 to 59.

Time function

Syntax:

DateVal = Time()

Returns the current system time as a date type.

Timer function

Syntax:

NumberVal = Timer()

Returns the number of seconds since 12:00:00 AM, with decimals up to 1/100th of a second.

TimeSerial function

Syntax:

DateVal = TimeSerial(Hour, Minute, Second)

Returns a date value for the specified Hour, Minute, and Second.

Note: Use this instead of a date literal if some of the parts of the time require calculations. Hour must be between 0 and 23.

TimeValue function

Syntax:

DateVal = TimeValue(Time)

Returns a date value for the specified Time. This will convert to date, like the CDate() function, but non-time parts of the date will be removed.

Note: A run-time error will occur if the value provided is not parse-able.

Weekday function

Syntax:

NumberVal = Weekday(Date, [FirstDayOfWeek = vbSunday])

Returns the numeric day of the week of the specified Date, from 1 to 7 in reference to the FirstDayOfWeek setting. See the first day of week settings for possible FirstDayOfWeek values.

Example: If your first day of week was vbSunday (1) and today was Saturday, the result would be 7 (seventh day of week). If your first day of week was vbSaturday (7) and today was Saturday, the result would be 1 (first day of week).

WeekdayName function

Syntax:

StringVal = WeekdayName(DayOfWeek, [Abbreviate = False],
[FirstDayOfWeek = vbSunday])

Returns the full name of the day of week for the specified numeric DayOfWeek. If Abbreviate is set to True, the three-letter day abbreviation will be returned instead. See the first day of week settings for possible FirstDayOfWeek values.

Note: DayOfWeek must be from 1 (first day of week) to 7 (seventh day of week).

Example: If your first day of week was vbSunday (1) and you passed 7 (seventh day of week), the result would be "Saturday". If your first day of week was vbSaturday (7) and you passed 7 (seventh day of week), the result would be "Friday".

Year function

Syntax:

NumberVal = Year(Date)

Returns the numeric year of the specified Date date value.

Format methods

These functions allow you to get a formatted string for a specified number or date, not specific to the user's language.

Many of these functions have "tri-state" arguments, where 0 (you can pass False) is "off", -1 (you can pass True) is "on", and -2 is "use system default setting".

FormatCurrency function

Syntax:

StringVal = FormatCurrency(Number, [DigitsAfterDecimal = -1],
[IncludeLeadingZero = -2], [UseParenthesesForNegative = -2],
[GroupDigits = -2])

Returns the provided Number formatted as a currency (preceded with "$" sign or "€" sign or other depending on locale). DigitsAfterDecimal specifies how many digits will appear after the decimal. -1 digits will use the system default setting. IncludeLeadingZero (whether a leading zero will appear for fractions), UserParanthesesForNegative (whether to put parentheses around negative numbers), and GroupDigits (whether to use grouping symbols like "," or "." for large numbers) are all numeric values where 0 is "off", -1 is "on", and -2 is "use system default setting". Return value is a string.

FormatDateTime function

Syntax:

StringVal = FormatDateTime(Date, Format)

Returns a string version of the specified Date formatted according to the date format constant specified in Format.

FormatNumber function

Syntax:

StringVal = FormatNumber(Number, [DigitsAfterDecimal = -1],
[IncludeLeadingZero = -2], [UseParenthesesForNegative = -2],
[GroupDigits = -2])

Returns the provided Number formatted as a number. DigitsAfterDecimal specifies how many digits will appear after the decimal. -1 digits will use the system default setting. IncludeLeadingZero (whether a leading zero will appear for fractions), UserParanthesesForNegative (whether to put parentheses around negative numbers), and GroupDigits (whether to use grouping symbols like "," or "." for large numbers) are all numeric values where 0 is "off", -1 is "on", and -2 is "use system default setting". Return value is a string.

FormatPercent function

Syntax:

StringVal = FormatPercent(Number, [DigitsAfterDecimal = -1],
[IncludeLeadingZero = -2], [UseParenthesesForNegative = -2],
[GroupDigits = -2])

Returns the provided Number formatted as a percentage (the number is also multiplied by 100 for you) with a "%" symbol. DigitsAfterDecimal specifies how many digits will appear after the decimal. -1 digits will use the system default setting. IncludeLeadingZero (whether a leading zero will appear for fractions), UserParanthesesForNegative (whether to put parentheses around negative numbers), and GroupDigits (whether to use grouping symbols like "," or "." for large numbers) are all numeric values where 0 is "off", -1 is "on", and -2 is "use system default setting". Return value is a string.

Math methods

These methods allow you to do mathematical operations not provided by the VBScript arithmetic operators.

Abs function

Syntax:

NumberVal = Abs(Number)

Returns the absolute value (distance from 0) of the specified number.

Atn function

Syntax:

NumberVal = Atn(Number)

Returns the arctangent (inverse tangent or tan-1) of the specified number. The return value is the number of radians of the angle.

Cos function

Syntax:

NumberVal = Cos(Number)

Returns the cosine of the specified numeric angle. Number is the angle in radians.

Exp function

Syntax:

NumberVal = Exp(Number)

Returns e (Euler's constant) raised to the specified power.

Int function

Syntax:

NumberVal = Int(Number)

Returns the integer part of the specified Number. This truncates a decimal.

Fix function

Syntax:

NumberVal = Fix(Number)

Returns the integer part of the specified Number. This truncates a decimal (same as Int().

Log function

Syntax:

NumberVal = Log(Number)

Returns the natural logarithm (log e X or ln X) of the specified Number. Mathematically to get a logarithm using a different base (such as common base-10) one would do Log(Number)/Log(Base).

Randomize subroutine

This method will "seed" the random number generator for Rnd(). This doesn't need to be called because StealthBot seeds it long before your script will run, though sometimes you may see it.

Syntax:

Randomize [Seed]

Seed is a number value you can provide to base the randomization on (since it can't be truly random[1]). By default the result of Timer() is used.

Rnd function

Syntax:

NumberVal = Rnd([Number])

Returns a random decimal (double) number greater than or equal to 0 and less than 1.

The value provided in Number (defaults to the result of Timer()) affect the output:

  • Number > 0 (the result of Timer() is always > 0) - Returns next random number in the sequence.
  • Number < 0 - Returns same number every time.
  • Number = 0 - Returns the most recently generated number.

In most cases, you do not need to provide a Number.

Round function

Syntax:

NumberVal = Round(Number, [DecimalPlaces = 0])

Returns a number rounded to the specified number of decimal places in DecimalPlaces.

Sgn function

Syntax:

NumberVal = Sgn(Number)

Returns a number based on the sign of the provided Number. If the number is positive (> 0), returns 1. If the number is negative (< 0), returns -1. If the number is zero (= 0), returns 0. This is similar to the result of the mathematical function ƒ(x) = |x| / x, or the absolute value of X divided by X (or its reciprocal x / |x|).

Sin function

Syntax:

NumberVal = Sin(Number)

Returns the sine of the specified numeric angle. Number is the angle in radians.

Sqr function

Syntax:

NumberVal = Sqr(Number)

Returns the square root of the specified number. To find another type of root than a square root, you have to use the ^ operator and the reciprocal of the origin: Number ^ (1/Origin).

Tan function

Syntax:

NumberVal = Tan(Number)

Returns the tangent of the specified numeric angle. Number is the angle in radians.

String methods

These methods allow you to manipulate strings.

InStr function

This is the only function starting with an optional parameter that has required parameters. Not even VB6 can create such functions.

Syntax:

NumberVal = InStr([Start = 1], String1, String2,
[CompareMode = vbBinaryCompare])

This function returns the location of the string String2 in String1 (1-based index in string). If String2 is not in String1 then the function returns 0. The function will start at the Start location (1-based index in string) and go to the end. After it finds the first occurrence of String2, the function will return. Specify the string compare mode with CompareMode (if CompareMode is specified, Start becomes a required argument).

InStrRev function

Syntax:

NumberVal = InStrRev(String1, String2, [Start = -1],
[CompareMode = vbBinaryCompare])

This function returns the location of the string String2 in String1 (1-based index in string). If String2 is not in String1 then the function returns 0. The function will start at the Start location (1-based index in string) and go backwards to the beginning. After it finds the first occurrence of String2 (the final occurrence in the string), the function will return. Specify the string compare mode with CompareMode.

LCase function

Syntax:

StringVal = LCase(Str)

This function returns the lower-case version of the provided string.

Left function

Syntax:

StringVal = Left(Str, Length)

This function returns up to Length characters from the beginning of the string provided.

Len function

Syntax:

NumberVal = Len(Str)

This function returns the length of the provided string.

LTrim function

Syntax:

StringVal = LTrim(Str)

This function returns the provided string with all of the spaces at the beginning (left side) removed.

Mid funciton

Syntax:

StringVal = Mid(Str, Start, [Length = some large number])

This function returns a part of the provided string that starts at the Start (1-based) position in the string and is Length characters long. When Length is provided, that many characters are returned. When length is not provided, everything from Start until the end of the string is returned.

Replace function

Syntax:

StringVal = Replace(Str, Find, ReplaceWith,
[Start = 1], [Count = -1], [CompareMode = vbBinaryCompare])

This function replaces the string Find with the string ReplaceWith wherever it is found in the string Str. If Find is not found, the value of Str is returned. The function will start at the provided Start location and keep replacing until the end, or until the number of replaces is equal to Count (if Count is -1, there is no limit). Specify the string compare mode with CompareMode.

Right function

Syntax:

StringVal = Right(Str, Length)

This function returns up to Length characters from the end of the string provided.

RTrim function

Syntax:

StringVal = RTrim(Str)

This function returns the provided string with all of the spaces at the end (right side) removed.

Space function

Syntax:

StringVal = Space(Number)

Returns the specified number in Number of spaces as a string.

StrComp function

Syntax:

NumberVal = StrComp(String1, String2, [CompareMode = vbBinaryCompare])

This function returns 0 (convertible to False) if the two strings are equal and 1 or -1 (convertible to True) if the two strings are unequal. Specify the string compare mode with CompareMode.

String function

Syntax:

StringVal = String(Number, Character)

This function returns a string containing a repeated character. The character is provided in Character and the number of repeats in Number. Character can be provided as either its ANSI code (see Asc()) or as a string. If Character is a string more than one character long, the first character is repeated.

StrReverse function

Syntax:

StringVal = StrReverse(Str)

This function reverses the provided string and returns it.

Trim function

Syntax:

StringVal = Trim(Str)

This function returns the provided string with all of the spaces at the beginning and end removed.

UCase function

Syntax:

StringVal = UCase(Str)

This function returns the upper-case version of the provided string.

Other methods

Several other functions are provided built-in to VBScript. These deal with several miscellaneous features, such as objects, the script engine, images, alerts, and locale.

CreateObject function

Set Object = CreateObject("ActiveXProject.ActiveXControl")

This function allows you to create an ActiveX (OCX files) object from the provided object name. It will attempt to find an object that it can create from an ActiveX control.

Here's a list of common ActiveX controls used in StealthBot scripting:

For other ways of making objects, see the list of script objects.

GetObject function

Set Object = GetObject([path], [class])

This function allows you to get an object from the specified path or class.

GetRef function

Set Object = GetRef(FunctionName)

This function returns an object reference (similar in idea to VB6's AddressOf operator) to the the function provided. It has no use in StealthBot scripting, but in website scripting is used to hook events.

Eval function

Value = Eval(Expression)

The expression is a string that will be evaluated. The result of the evaluation will be returned from Eval(). All functions and expressions available to the script are available to the code in the string. This can be used to get the value of a dynamically created variable whose name is not known when the script is being written.

Example: If the Expression is "1 + 1", Eval() will return 2.

Execute subroutine

Execute Expression

The expression is a string that will be evaluated. All functions and expressions available to the script are available to the code in the string. This can be used to create and manipulate variables and code constructs dynamically, whose names are not known when the script is being written. Execute() will evaluate the expressions as if it was written in the current function scope (other functions cannot be created inside functions).

Example: If the Expression is "VariableName = 1", the variable VariableName will be given the value 1 (inside the current function).

ExecuteGlobal subroutine

ExecuteGlobal Expression

The expression is a string that will be evaluated. All functions and expressions available to the script are available to the code in the string. This can be used to create and manipulate variables and code constructs dynamically, whose names are not known when the script is being written. ExecuteGlobal() will evaluate the expressions as if it were written in the global scope (you can use this to create event subroutines that StealthBot can call back to for objects you created with arbitrary names).

Example: If the Expression is "VariableName = 1", the variable VariableName will be given the value 1 (in the global scope).

ScriptEngine function

StringVal = ScriptEngine()

This function will return the script engine language. It will return the string "VBScript".

ScriptEngineMajorVersion function

StringVal = ScriptEngineMajorVersion()

This function will return the script engine major version number. It will return the number 5.

ScriptEngineMinorVersion function

StringVal = ScriptEngineMinorVersion()

This function will return the script engine minor version number. It will return the number 7.

ScriptEngineBuildVersion function

StringVal = ScriptEngineBuildVersion()

This function will return the script engine build number. It will return the number 18066.

LoadPicture function

Set Pict = LoadPicture(Path)

This function will load a picture from the provided Path and store it in an object. This can be used to populate a VB6 ImageList provided by StealthBot.

RGB function

LngColor = RGB(Red, Green, Blue)

This function will return a long color value from the provided Red, Green, and Blue values (0 to 255 for each). This can be used in the AddChat function to specify color, or for colors of VB6 objects provided by the CreateObj function. Alternatively, StealthBot scripters can use the Color object or plain hexadecimal to specify colors.

InputBox function

StringVal = InputBox(Text,
[Title = vbNullString], [Default = vbNullString],
[XPos = center screen], [YPos = center screen],
[helpfile], [context])

This function creates a dialog box which allows the user to input text.

  • Text specifies the text that the input box will show.
  • Title specifies the text in the title bar of the input box window.
  • Default specifies the text that will appear in the input field when the box appears.
  • XPos specifies the number of pixels from the left side of the screen to show the box. If you don't provide this value, the box will appear approximately in the middle of the screen.
  • YPos specifies the number of pixels from the top of the screen to show the box. If you don't provide this value, the box will appear approximately in the middle of the screen.
  • HelpFile and Context specify the file and context number of help documentation for this dialog. If specified and valid, a help button will appear.

This function returns the string that was inputted. If the user hits Cancel, vbNullString is returned.

MsgBox function

NumberVal = MsgBox(Text,
[Flags = vbOKOnly], [Title = vbNullString],
[helpfile], [context])

This function creates a dialog box to ask or tell a user something.

  • Text specifies the text that the message box will show.
  • Flags specifies a numeric message box constant combination describing the box.
  • Title specifies the text in the title bar of the message box window.
  • HelpFile and Context specify the file and context number of help documentation for this dialog. If specified and valid, a help button will appear.

This function returns a number comparable to a message box result constant.

GetLocale function

NumberVal = GetLocale()

This function will get the LCID value for the current system (for example 1033 for English (US).)

SetLocale function

NumberVal = SetLocale(LCID)

This function will set the LCID value for the current system to the value provided in LCID. This will affect language/country preference for the current computer. The function will return the previous LCID.

See also