Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Support for env vars in WK script

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
I'm using WK 5.5 for Windows, invoking WebKing scripts from a batch file, and am wondering if there is syntax for specifying folder paths via an environment variable for commands that take a filename parameter, such as 'open' and 'savereport'? Something like

open %VAR%\project.wkj
open $VAR\project.wkj

The examples in the documentation use explicit absolute or relative paths to the file argument.

Thanks...

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    This feature is not currently implemented in WebKing as of now. However there will be a feature request added because of this. There is a workaround for this however. You can write a script in either python or javascript to access any evironment variables you may need, and construct file paths using standard python and javascript techniques. The script must also use the WebKing scripting API to execute the commands. For more information on this see the "Executing JavaScript or Python Scripts from the Command Line" subsection of the "Running WebKing From the Command Line" section of the documentation. To run this script type: wk.exe -cmd -run <scriptname>.

    Please let me know if you need any furthur assistance with this.