Forum Discussion

rasmus's avatar
rasmus
New Contributor
4 years ago
Solved

Environment variable in persistent variables declaration

I want to use a Windows environment variable in the persistent variables section of a keyword test.

E.g. Something line InstallFolder is %TEMP%\MyAppLocation.

Using the variable InstallFolder works fine when defining the tested apps. E.g MyApp is $(InstallFolder)\MyApp.exe. The application starts as expected.

 

But when adding a check in JavaScript to verify if the InstallFolder folder exists, the check fails because the variable %TEMP% is not expanded.

E.g.  aqFileSystem.Exists(Project.Variables.InstallFolder) returns false because Project.Variables.InstallFolder returns the string %TEMP%\MyAppLocation and not <Where ever my temp folder is>\MyAppLocation.

 

How can I fix this?

 

I'm new to TestComplete. So if my question may be a little bit unprecise. Hope it is not too confusing ...

 

TestComplete 14.40

Windows 10

Scripting language JavaScript

7 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Let's see the actual code from both calls.  It's probably just a syntax difference but we need to see it in order to help.

    • rasmus's avatar
      rasmus
      New Contributor

      What's the best way to show the code? 

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        You can copy paste or insert a screenshot.  Up to you.