UNIDAD 1: VBSCRIPT ELEMENTOS BASICOS
TEMA APENDIC1D: VISUAL BASIC SCRIPT PALABRAS RESERVADAS
Category/Keyword
Type
Usage
Arithmetic
Atn
Function
Returns the arctangent of a numberAtn(number)
Cos
Function
Returns the cosine of an angleCos(number)
Exp
Function
Returns a number raised to a powerExp(number)
Log
Function
Returns the logarithm of a numberLog(number)
Randomize
Statement
Primes the internal random number generatorRandomize
Rnd
Function
Returns a random numberRnd
Sin
Function
Returns the sine of an angleSin(number)
Sqr
Function
Returns the square root of a numberSqr(number)
Tan
Function
Returns the tangent of an angleTan(number)
Array handling
Dim
Statement
Declares an arrayDim arrayname([subscripts])
Erase
Statement
Clears the contents of an arrayErase arrayname
IsArray
Function
Returns True if var is an array, and False if notIsArray(var)
Lbound
Function
In VBScript, always returns 0Lbound(arrayname)
Preserve
Statement
Copies the contents of a dynamic array to a resized dynamic arrayRedim Preserve arrayname(subscripts)
ReDim
Statement
Declares a dynamic array or redimensions a dynamic array (see Preserve)ReDim arrayname() orReDim arrayname([subscripts])
UBound
Statement
Returns the largest subscript of an arrayUbound(arrayname)
Assignment
=
Operator
Assigns a value to a variable or property variable = value
Set
Statement
Assigns an object reference to a variableSet variable = object
Comment
Rem
Statement
Declares the following line as a comment to be ignored by the languageengineRem comment_text
Constants/Literals
Empty
Literal
Declares a special uninitialized variablevalue variable = Empty
False
Constant
A Boolean value representing 0 variable = False
Nothing
Literal
Used to disassociate an object reference from a variable; used inconjunction with SetSet variable = Nothing
Null
Literal
Represents no valid datavariable = Null
True
Constant
Boolean value representing -1variable = True
Conversions
Abs
Function
Returns the unsigned (absolute) value of a numberAbs(number)
Asc
Function
Returns the ANSI/ASCII code of a characterAsc(string)
CBool
Function
Returns a Boolean subtype Variant value from any valid expressionCBool(expression)
CByte
Function
Returns a Byte subtype Variant value from any valid expressionCbyte(expression)
CDate
Function
Returns a Date subtype Variant value from any valid date expressionCDate(expression)
CDbl
Function
Returns a Double Precision subtype Variant value from any valid numericexpressionCDbl(expression)
Chr
Function
Returns the character corresponding to the ANSI or ASCII code Chr(number)
CInt
Function
Returns an Integer subtype Variant value from any valid numeric expressionCInt(expression)
CLng
Function
Returns a Long Integer subtype Variant value from any valid numericexpressionCLng(expression)
CSng
Function
Returns a Single Precision subtype Variant value from any valid numericexpressionCSng(expression)
CStr
Function
Returns a String subtype Variant value from any valid expressionCStr(expression)
DateSerial
Function
Returns a Date subtype Variant from valid year, month, and day valuesDateSerial(year,month,day)
DateValue
Function
Returns a Date subtype Variant value from any valid date expressionDateValue(expression)
Hex
Function
Returns a String subtype Variant representing the hexadecimal value of anumberHex(number)
Int
Function
Returns an Integer subtype Variant rounded down from the number suppliedInt(number)
Fix
Function
Returns an Integer subtype Variant rounded up from the number suppliedFix(number)
Oct
Function
Returns a String subtype Variant representing the octal value of a numberHex(number)
Sgn
Function
Returns an Integer subtype Variant representing the sign of a numberSgn(number)values > 0 return 1values = 0 return 0values
TimeSerial
Function
Returns a Date subtype Variant from valid hour, minute, and second valuesTimeSerial(hour,minute,second)
TimeValue
Function
Returns a Date subtype Variant value from any valid time expressionTimeValue(expression)
Dates and Times
Date
Function
Returns the current system dateDate()
DateSerial
Function
Returns a Date subtype Variant from valid year, month, and day values.DateSerial(year,month,day)
DateValue
Function
Returns a Date subtype Variant value from any valid date expression.DateValue(expression)
Day
Function
Returns an Integer subtype Variant representing the day (1-31) from avalid date expressionDay(dateexpression)
Hour
Function
Returns an Integer subtype Variant representing the hour (0-23) from avalid time expressionHour(timeexpression)
Minute
Function
Returns an Integer subtype Variant representing the minute (0-60) from avalid time expressionMinute(timeexpression)
Month
Function
Returns an Integer subtype Variant representing the month (1-12) from avalid date expressionMonth(dateexpression)
Now
Function
Returns the current date and time of the systemNow()
Second
Function
Returns an Integer subtype Variant representing the second (0-60) from avalid time expressionSecond(timeexpression)
Time
Function
Returns the current system time Time()
TimeSerial
Function
Returns a Date subtype Variant from valid hour, minute and second valuesTimeSerial(hour,minute,second)
TimeValue
Function
Returns a Date subtype Variant value from any valid time expressionTimeValue(expression)
Weekday
Function
Returns an Integer subtype Variant between 1 and 7 representing the dayof the week, starting at Sunday, from a date expressionWeekday(dateexpression)
Year
Function
Returns an Integer subtype Variant representing the year from a validdate expressionYear(dateexpression)
Declarations
Dim
Statement
Declares a variableDim variable
End
Statement
Declares the end of a Sub procedure or functionEnd SubEnd Function
Statement
Use with Do, For, Function, or Sub to prematurely exit the routineExit Do/For/Function/Sub
Function
Statement
Declares a function and the argument list passed into the function, anddeclares the end of a function; also used with Exit to prematurely end afunctionFunction functionname(argumentlist)Exit FunctionEnd FunctionPublic variable
Sub
Statement
Declares a custom procedure or event handler and the argument list, ifany, and declares the end of a custom procedure or event handler; alsoused with Exit to prematurely end a custom procedure or event handlerSub subroutinename([argumentlist])Exit SubEnd Sub
Error Handling
Clear
Method
A method of the Err object to reset the Err.Number property to 0Err.Clear
Description
Property
A property of the Err object that contains a description of the lasterror as specified in the Err.Number propertyErr.Description
Err
Object
An object containing information about the last errorErr.property|method
On Error
Statement
Used in conjunction with Resume Next to continue execution with the linedirectly following the line in which the error occurredOn Error Resume Next
Raise
Method
A method of the Err object used to simulate the occurrence of an errorspecified by numberErr.Raise(errornumber)
Number
Property
A property of the Err object that contains the error code for the lasterror, or 0 if no error has occurredErr.Number
Source
Property
Returns the name of the object or application that raised the errorErr.Source
Input/Output
InputBox
Function
Displays a dialog box to allow user inputInputBox(caption[,title][,value][,x][,y])
MsgBox
Function
Displays a dialog boxMsgBox(prompt[, definition][, title])
Operators
+
Operator
Addition of two numerical expressionsresult = expr1 + expr2
And
Operator
Logical conjunction operatorIf expression AND expression Then
/
Operator
Division operatorresult = expression / expression
=
Operator
Equality operatorIf expression = expression Then
Eqv
Operator
Logical equivalence operatorIf expression Eqv expression Then
Operator
Exponentiation operatorresult = expression ^ expression
Operator
Greater than comparisonIf expression > expression Then
=Operator
Greater than or equal to comparisonIf expression >= expression Then
Imp
Operator
Logical implicationIf expression Imp expression Then
Operator
Inequality comparisonIf expression expression Then
Operator
Integer division operatorresult = expression expression
Operator
Less than comparisonIf expression
⇐
Operator
Less than or equal to comparisonIf expression ⇐ expression Then
Mod
Operator
Modulus arithmetic; returns only the remainder of a division of twonumbersresult = expression mod expression
*
Operator
Multiplicationresult = expression * expression
-
Operator
Subtractionresult = expression - expression
Or
Operator
Logical disjunctionIf expression Or expression Then
&
Operator
Concatenation of two string valuesresult = string & string
Xor
Operator
Logical exclusionIf expression Xor expression Then
Options
Option
Statement
Forces a compile-time error if anExplicit undeclared variable is foundOption Explicit
Program Flow
Call
Statement
Passes execution to a subroutine or event handler; also can be used toreplicate the actions of the userCall myroutine()Call cmdbutton_OnClick()
Do…Loop
Statement
Repeats code while a condition is met or until a condition is metDo While condition…LooporDo Until condition…Loop
orDo…Loop While conditionorDo…Loop Until condition
For…Next
Statement
Repeats a block of code until the counter reaches a given numberFor counter = lower to upper [step]…Next
If…Then…Else
Statement
Conditional execution of codeIf condition Then…(if condition metElse)… (if condition not met)End If
Select Case
Statement
Selective execution of code, where
testexpression must match expressionSelect Case testexpressionCase expression…Case expression…Case ElseEnd Select
While…Wend
Statement
Execution of a code block while a condition is metWhile expression…Wend
Strings
InStr
Function
Returns the starting point of one string within another string, or 0 ifnot foundresult = InStr(start,searched,sought)
Lcase
Function
Converts a string to lowercaseresult = LCase(string)
Left
Function
Returns the n leftmost characters of a stringresult = LCase(string)
Len
Function
Returns the length of a stringresult = Len(string)
Ltrim
Function
Removes all leading spacesresult = LTrim(string)
Mid
Function
Returns a string of length L, starting at S withinstring result = Mid(string, S, L)
Right
Function
Returns the rightmost n charactersresult = Right(string, n)
RTrim
Function
Removes all trailing spaces from a stringresult = RTrim(string)
Space
Function
Returns a string consisting of n spaces result = Space(n)
StrComp
Function
Returns an Integer subtype Variant representing the result of acomparison of two stringsresult = StrComp(string1, string2)string1
String
Function
Returns a string consisting of character C, of length Lresult = String(L, C)
Trim
Function
Removes both leading and trailing spacesresult = Trim(string)
UCase
Function
Returns a string as uppercase alphabetical charactersresult = UCase(string)
Variants
IsArray
Function
Returns True (-1) if expression is an array, and False (0) if not result= IsArray(expression)
IsDate
Function
Returns True (-1) if expression is a valid date and False (0) if notresult = IsDate(expression)
IsEmpty
Function
Returns True (-1) if expression equates to an Empty subtype and False (0)if notresult = IsEmpty(expression)
IsNull
Function
Returns True (-1) if expression equates to a Null subtype and False (0)if notresult = IsNull(expression)
IsNumeric
Function
Returns True (-1) if expression is a valid numeric expression and False(0) if notresult = IsNumeric(expression)
VarType
Function
Returns an integer representing the sub data type of a Variantresult = VarType(expression)
PALABRAS RESERVADAS VBSCRIPT VISUAL BASIC SCRIPT
Returns the cosine of an angleCos(number) Function Function Cos Cos Returns the arctangent of a numberAtn(number) Returns the arctangent of a numberA
programar
es
https://aprendeprogramando.es/static/images/programar-palabras-reservadas-vbscript-visual-basic-script-323-0.jpg
2025-01-10
El contenido original se encuentra en https://programacionfacil.com/visual_basic_script/palabras_reservadas_vbscript/
Todos los derechos reservados para el autor del contenido original (en el enlace de la linea superior)
Si crees que alguno de los contenidos (texto, imagenes o multimedia) en esta página infringe tus derechos relativos a propiedad intelectual, marcas registradas o cualquier otro de tus derechos, por favor ponte en contacto con nosotros en el mail [email protected] y retiraremos este contenido inmediatamente