Micro Focus QTP (UFT) Forums
How to get the input value from .vbs file to QTP Script? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to get the input value from .vbs file to QTP Script? (/Thread-How-to-get-the-input-value-from-vbs-file-to-QTP-Script)



How to get the input value from .vbs file to QTP Script? - Uma - 10-13-2011

Hi,
I have a.Vbs file,here i am having input box

Code:
fav-env=inputbox("enter ur enviorn...")
if fav-env=A then
open link
elseif ....
open second link....

endif


I call this procedure in Qtp Script using the command
Call mainentra

Now I need this fav-env value for furthur functionality test.I want to keep this as for input parameter.How to store this value in to my QTp Script?
Any help?
Thank you,
Uma


RE: How to get the input value from .vbs file to QTP Script? - himateja - 10-14-2011

Hi Uma,

Before you enter the env value (ie:fav-env) into the input box ,save it to a variable ('inp_Var').
We know only once your condition is true the link in if loop will open.Hence if the correct link is open then verify your inp_Var with the input source..may be datable or another variable value.

There is also another method of reading your .vbs file and verifying the fav-env value.In qtp we have code for read and write text file.Please go through qtp help.

if wrong please correct me.

Thanks,
Himateja.


RE: How to get the input value from .vbs file to QTP Script? - Ankesh - 10-14-2011

Hi Uma,

The first thing that u need to do is to associate the .vbs file to QTP by navigationg to File->Settings->Resources. Here attach the .vbs file. Second point is that when u need some value(which is in ur .vbs file) to be used in ur script, u must return the value to the function... Chk the sample code below..

'----- function-----
Code:
Suppose ur function is
Function Open_Link()
  
   fav_env=inputbox("enter ur enviorn...")
    if fav_env=A then
       open link
   elseif ....
      open second link....

   endif
   'Return the value to the function
   Open_Link=fav_env
End Function
'Now to call this function is ur QTP script, u can use the below code

FunctionReturnValue=Open_Link() ' Here FunctionReturnValue will have the value which u have enterd in Input box.

Do let me know if it does not work.

Regards,
Ankesh


RE: How to get the input value from .vbs file to QTP Script? - Uma - 10-17-2011

Thank you both of you,
I try and put the final result.
Uma


RE: How to get the input value from .vbs file to QTP Script? - Uma - 10-18-2011

Ankesh,
It is working.
Thank you
Uma