Micro Focus QTP (UFT) Forums
Accessing Environment variable value in Library file - 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: Accessing Environment variable value in Library file (/Thread-Accessing-Environment-variable-value-in-Library-file)



Accessing Environment variable value in Library file - vishruth143 - 08-22-2013

Hi All,

I have a environment variable defined in the external Environment.vbs file. And I am trying to access its value and assign to a variable in library file. and then using the variable in library in action. I'm getting an error saying the couldn't able to find the environment variable.

I have the below file and content

------------------------------------------------------
Environment.vbs
------------------------------------------------------
Environment.Value("URL") = "www.google.com"
------------------------------------------------------


-------------------------------------------------------
MyLibrary.qfl
-------------------------------------------------------
strURL = Environment.Value("URL")
-------------------------------------------------------

-------------------------------------------------------
MyAction
-------------------------------------------------------
SystemUtil.Run strURL
-------------------------------------------------------

Thanks and Regards:
Vishruth


RE: Accessing Environment variable value in Library file - jacosta - 09-07-2013

Hi,
You better use a variable public instead of an environment variable, I have worked very well to work with files .vbs
greetings.