B VBScript06

Share Embed Donate


Short Description

Download B VBScript06...

Description

VBScript Session 6

What we learn last session?

Looping through code. Conditional looping. Linear looping. Collection looping. Forced exiting loops.

Subjects for session 6 The MsgBox function The InputBox function. VBScript Constants

An easy way to interact Showing an output MsgBox Hello World! “



Getting an input: Name = InputBox ( Who are you? ) “



The MsgBox function

Displays a message in a dialog box, waits for the user to click a button, and returns a value indicating which button the user clicked. prompt[, buttons][, buttons][, title][, title][, helpfile, helpfile, context]) context]) MsgBox (prompt[,

The InputBox function

Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns the contents of the text box. InputBox (prompt[, title][, default] [, xpos] [, ypos][, helpfile, context])

VBScript Constants

A number of useful constants you can use in your code are built into VBScript. Constants provide a convenient way to use specific values without actually having to remember the value itself. Using constants also makes your code more maintainable should the value of any constant ever change. Because these constants are already defined in VBScript, you don't need to explicitly declare them in your code. Simply use them in place of the values they represent.

Constants MsgBox Constants Defines constants used in the MsgBox function to describe button visibility, labeling, behavior, and return values

Color Constants Defines eight basic colors that can be used in scripting RGB, CMYK.

Date and Time Constants Defines date and time constants used by various date and time functions.

Miscellaneous Constants Defines constants that don't conveniently fit into any other category.

Constants String Constants Defines a variety of non-printable characters used in string manipulation.

Tristate Constants Defines constants used with functions that format.

VarType Constants Defines The various variant subtypes.

Excercise

Lab 6.1 Use the InputBox for retrieve a password, title login to EX 6.1. If the If the input is an empty string, exit the program. Declare a constant MY_PASSWORD. Declare a constant MAX_RETRY = 3. If the password is correct display a MsgBox with a wellcome message + information icon + EX 6.1 title. Display a message each time password incorrect + question icon and a question to retry or cancel the login process. If the password is typed wrong more then MAX_RETRY times, display an error message with an error icon, then exit the program. Use the Do..Loop (While or Until). Tip Use the Exit Loop statement. Check the value returned from MsgBox.

Make sure to visit us Tutorials Articles Projects And much more www.AdvancedQTP.com

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF