Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

What should I do if the sDir and sCmdLine values of my recovery system differ from machine to machine?

What should I do if the sDir and sCmdLine values of my recovery system differ from machine to machine?

This can sometimes be the case if the application under test is located in different locations throughout your testing machines.

This will occur if using Microsoft Click Once Smart Client technology. When the application is launched, the "Click Once Framework" launches the applications after downloading updated versions of the assemblies. Then the executables are launched. This causes the executables to be specific to a machine / user environment.

A workaround is to place the executable path and command line to invoke the application in a text file inside the specific users "My Documents" folder.

Here we have two variables (sDirVariable and sPathVariable) which get their values returned from two separate functions (GetsCmdLine and GetsDir), that open individual text files to retrieve the working directory and command line of the application under test.

The two files will be like so

The "FileReadLine" function will read the paths from the text files and place them in the SDir and cCmdLine variables.

[ ] const wMainWindow = TestApplication
[ ] 
[ ] STRING sDirVariable = GetsDir()
[ ] STRING sPathVariable = GetsCmdLine ()
[ ] 
[-] STRING GetsDir ()
    [ ] HFILE hFile
    [ ] STRING sLine
    [ ] 
    [ ] hFile = FileOpen ("C:\Documents and Settings\moreilly\My Documents\MyDirectory.txt", FM_READ)
    [ ] FileReadLine (hFile, sLine)
    [ ] FileClose (hFile)
    [ ] return sLine
    [ ] 
[-] STRING GetsCmdLine ()
    [ ] HFILE hFile
    [ ] STRING sLine
    [ ] 
    [ ] hFile = FileOpen ("C:\Documents and Settings\moreilly\My Documents\MyCommandLine.txt", FM_READ)
    [ ] FileReadLine (hFile, sLine)
    [ ] FileClose (hFile)
    [ ] return sLine
[ ] 
[-] window JavaMainWin TestApplication
    [ ] tag "Test Application"
    [ ] 
    [ ] //The working directory of the application when it is invoked
    [ ] const sDir = sDirVariable
    [ ] 
    [ ] //The command line used to invoke the application
    [ ] const sCmdLine = sPathVariable

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:16
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.