Cast()

Auto Hotkey

Cast

Converts a value from one data type to another data type.

OutputVar := Cast(DataType, VarOrValue, NewDataType)
Function Example: NewValue := Cast("float",2.5,"UInt")

Parameters

OutputVar

The name of the variable in which to store the converted value.

DataType

Data type of given variable or value, must be one of the following strings:
UInt, Int, Int64, Short, UShort, Char, UChar, Double, Float, Ptr or UPtr

VarOrValue

The variable or a value to be converted.

NewDataType

Data type to convert to, must be one of the strings as in DataType.

Examples

MsgBox Cast("float",1.4,"int")
MsgBox Cast("int",-1,"uchar")