18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

Day<br />

Description Returns a whole number between 1 and 31, inclusive, representing the day of the month<br />

Usage intVal = Day(date)<br />

Arguments date<br />

The date argument is any valid date expression.<br />

Return An integer value representing the day of the month (1-31).<br />

Remarks A runtime error occurs if date is not a valid expression. If date contains Null, Null is returned<br />

See Also Date, DateSerial, DateValue, Month, Now, TimeSerial, TimeValue, Weekday, Year<br />

Example Dim MyDay<br />

MyDay = Day (“October 19, 1962”) ‘ MyDay contains 19<br />

Escape<br />

Description Encodes a string so it contains only ASCII characters<br />

Usage strChar = Escape(charString)<br />

Arguments charString<br />

Required. String expression to be encoded.<br />

Remarks The Escape function returns a string (in ASCII <strong>for</strong>mat) that contains the contents of charString.<br />

All spaces, punctuation, accented characters, and other non-ASCII characters are replaced with<br />

%xx encoding, where xx is equivalent to the hexadecimal number representing the character.<br />

Unicode characters that have a value greater than 255 are stored using the %uxxxx <strong>for</strong>mat<br />

See Also UnEscape<br />

Example Dim cs<br />

cs = Escape(“aÖ”) ‘Returns “a%D6”<br />

Eval<br />

Description Evaluates an expression and returns the result<br />

Usage boolVal = Eval(expression)<br />

Arguments expression<br />

Required. String containing any legal <strong>VBScript</strong> expression<br />

Returns A boolean value<br />

Remarks In <strong>VBScript</strong>, x = y can be interpreted two ways. The first is as an assignment statement, where<br />

the value of y is assigned to x. The second interpretation is as an expression that tests if x and y<br />

have the same value. If they do, the result is True; if they are not, the result is False. The Eval<br />

method always uses the second interpretation, whereas the Execute statement always uses the<br />

first<br />

See Also Execute<br />

Example Sub GuessANumber<br />

Dim Guess, RndNum<br />

RndNum = Int((100) * Rnd(1) + 1)<br />

Guess = CInt(InputBox("Enter your guess:",,0))<br />

Do<br />

If Eval("Guess = RndNum") Then<br />

MsgBox "Congratulations! You guessed it!"<br />

Exit Sub<br />

Else<br />

Guess = CInt(InputBox("Sorry! Try again.",,0))<br />

End If<br />

Loop Until Guess = 0<br />

End Sub<br />

<strong>InduSoft</strong>, Ltd. 129

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!