1 / 12

VBScript

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

uri
Download Presentation

VBScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VBScript Session 6

  2. What we learn last session? • Looping through code. • Conditional looping. • Linear looping. • Collection looping. • Forced exiting loops.

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

  4. An easy way to interact • Showing an output • MsgBox“Hello World!” • Getting an input: • Name = InputBox (“Who are you?”)

  5. 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. • MsgBox (prompt[, buttons][, title][, helpfile, context])

  6. 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])

  7. 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 theyrepresent.

  8. 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.

  9. 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.

  10. Excercise

  11. Lab 6.1 • Use the InputBox for retrieve a password, title login to EX 6.1. • Ifthe 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.

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

More Related