Intellipro     

Automating Test Automation                  Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map

General Function - Get User Input

Sometimes it's useful to solicit user input, but it's important for the test to continue if the user isn't present.

If you find an error, or have a suggestion for improvement, Email me and I'll fix it.

Download it Here (right-click and then save target as).

(NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).

'=========================================================================

Function zGen_GetUserInput (sTitle, sPrompt, sDefault, iDelay)

'Sometimes it's useful to solicit user input, but it's important for the test to continue if the user isn't present

'Example of Usage:
'    sInput = zGen_GetUserInput ("Title", "Prompt:", "<DefaultValue>", 5)

    Dim sTemp, oShell, iUserSelection

    If iDelay = 0 Then

        'Wait forever for user input..
        sTemp = Inputbox (sPrompt, sTitle, sDefault)

    Else

        'Wait for set delay before continuing regardless

        Set oShell = CreateObject("Wscript.Shell")

        'Does the user want to input data - popup will disappear after set delay.
        iUserSelection = oShell.Popup ("Press OK if you want to enter new data", iDelay, "Select")

        'NOTE -1 means the popup closed without any user interaction

        If iUserSelection <> -1 Then
            sTemp = Inputbox (sPrompt, sTitle, sDefault)

        Else
            sTemp = sDefault

        End If

        Set oShell = Nothing

    End If

    zGen_GetUserInput = sTemp

End Function

'=========================================================================


Copyright © 2011 Intellipro Services Ltd. All rights reserved                      Home About Privacy Policy Terms of use Contact Site Map






































































advanced advice agile answers application articles aut automated automating automation basics beginners browser button checkbox child childobjects click close code coding combo combobox consultant consultancy convention count createobject database delete descriptive download downloads dp edit editbox element enhancements error examples faq faqs file files filesystemobject fixes folder folders forum framework frameworks function functions generation generator getobject getroproperty gotchas group guide guru harness hewlett hp inputbox insert intellipro interview language library libraries link list listbox manifesto manual master name naming navigate object or packard page ping pro problem procedure procedures professional programming qtp query queries question questions quick quicktest radio refresh repository ross row rows samples script scripts scrum select server software specific sprint sql step stored strategy structure sub subroutine suite sync tables test testing text textbox title tool tools tsl tutorial update updates url vbscript web webedit webpage webradiogroup weblist whittaker wscript