Thanks Roman!
BTW, assuming that i would like to use option 1 (batch),
how do i pass back the user selection to the QTP?
thanks
On Nov 27, 7:15 am, "Roman Zilber" <[EMAIL PROTECTED]> wrote:
> The options 2 and 3 can be the same, you can include my code in QTP
> directly, only you'd need to remove the "WScript." and instead of "msgbox"
> do
> var = GetChioce()
> or better
> Environment("VAR_NAME") = GetChioce() and you can use this value in any
> function in your test.
>
>
>
> > Thanks Roman for the help!
>
> > Since i am running it from QTP, i have two options:
>
> > 1. Calling the following .bat file consisting of the following script:
> > =================================================
> > @ECHO OFF
> > CLS
> > :LOOP
> > ECHO 1. KTX-4
> > ECHO 2. V910
> > ECHO 3. VN755
> > ECHO 4. SURVEYOR VFT
> > ECHO 5. VN301T
> > ECHO Q. Quit
> > :: SET /P prompts for input and sets the variable
> > :: to whatever the user types
> > SET Choice=
> > SET /P Choice=Please type your selection number and press Enter:
> > :: The syntax in the next line extracts the substring
> > :: starting at 0 (the beginning) and 1 character long
> > IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
> > ECHO.
> > :: /I makes the IF comparison case-insensitive
> > IF /I '%Choice%'=='1' GOTO Item1
> > IF /I '%Choice%'=='2' GOTO Item2
> > IF /I '%Choice%'=='3' GOTO Item3
> > IF /I '%Choice%'=='4' GOTO Item4
> > IF /I '%Choice%'=='5' GOTO Item5
> > IF /I '%Choice%'=='Q' GOTO End
> > ECHO "%Choice%" is not valid. Please try again.
> > ECHO.
> > GOTO Loop
> > :Item1
> > ECHO Insert commands for Item 1.
> > GOTO Again
> > :Item2
> > ECHO Insert commands for Item 2.
> > GOTO Again
> > :Item3
> > ECHO Insert commands for Item 3.
> > GOTO Again
> > :Item4
> > ECHO Insert commands for Item 4.
> > GOTO Again
> > :Item5
> > ECHO Insert commands for Item 5.
> > GOTO Again
> > :Again
> > PAUSE
> > CLS
> > GOTO Loop
> > :End
> > =============================
> > 2. Running the script you've provided
> > 3. Prompt a user dialog \ Message Box consisting of a list of items
> > that the user should select one of them.
> > Once selected, the item value can be passed to other QTP functions
>
> > I'm aiming for the third option, since i think its the most elegant
> > one.
> > can you help me on this one?
>
> > Thanks again!
>
> > On Nov 26, 4:47 pm, "Roman Zilber" <[EMAIL PROTECTED]> wrote:
> > > dialog.vbs (if you use teh function in QTP remove "WScript.")
>
> > > Function GetChioce()
>
> > > Dim WshShell
> > > Set WshShell = WScript.CreateObject("WScript.Shell")
> > > Set oIE = CreateObject("InternetExplorer.Application")
> > > oIE.Visible = True
> > > oIE.Navigate "C:\dialog.html"
>
> > > Do While oIE.Busy Or (oIE.READYSTATE <> 4)
> > > Wscript.Sleep 10
> > > Loop
>
> > > Do While oIE.document.getElementById("s1").selectedIndex = 0
> > > Wscript.Sleep 10
> > > Loop
>
> > > GetChioce = oIE.document.getElementById("s1").selectedIndex
> > > oIE.Quit
> > > End Function
>
> > > MsgBox GetChioce()
>
> > > dialog.html
>
> > > <select id=s1>
> > > <option>Make your choice...
> > > <option>1
> > > <option>2
> > > </select>
>
> > > On Wed, Nov 26, 2008 at 5:47 AM, Lior <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I'm trying to display a user dialog with a list of several items.
> > > > I need to "force" the user select one of the items, and pass the
> > > > selected string \ value selected to a global variable
>
> > > > does anyone have an idea how to implement this one?- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---