Forum Discussion

KCarper's avatar
Occasional Contributor
4 years ago

Save full path to pjs folder so its machine independent

I test several products that are launched from different places such as a script called by bamboo, a test started from QAComplete or running the TestComplete app on my PC. 

The drives, paths and filenames are different for each project on our PCs as well as those on our servers.  Examples follow.

  1. PC1 proj1 = C:\BASE\1_H\1H\x1.pjs
  2. PC1 proj2 = C:\BASE\1_H\1H\y1.pjs
  3. PC1 proj3 = C:\BASE\2_H\2H\z1.pjs
  4. PC1 proj4 = C:\BASE\2_H\3H\z1.pjs
  5. Server1 =C:\PROMOTE\1_H\1H\x1.pjs
  6. Server1 =C:\TESTING\1_H\1H\x1.pjs
  7. Server2 =D:\TESTING\1_H\1H\x1.pjs

 Question: How do I set Project.Variable.mypath to the <drive and folders> containing x1.pjs so it doesn't matter what machine I'm on.  Assume that I did not launch the pjs from within that folder "D:\TESTING\1_H\1H" and testcomplete is in System %Path%.  Assume at startup default for Project.Variable.mypath= c:\temp since all systems have it.   Example:

  • Run from commandline C:\>testcomplete.exe D:\TESTING\1_H\1H\x1.pjs. 
  • At startup: Project.Variable.mypath=c:\temp
  • How do I assign persistent Project.Variable.mypath= D:\TESTING\1_H\1H\
  • In persistent project variables, can I define A as %Project.Variable.mypath%\A.txt Or do I need to build them once the directory has been defined using the function setVariableValue(Project.Variables.A, %Project.Variable.mypath%\A.txt)