You can use file statements to perform actions on and return values from files and directories. See File statements. For best results, use full paths in these statements to identify the exact files and directories to interact with. If you use relative paths, an incorrect file or directory could be used during playback if files or directories with the same names are stored in different locations QA Wizard Pro searches. See Using relative paths.
To create a full path relative to a directory, use the CombinePaths statement in scripts. This statement uses the returned workspace or script directory and combines it with a filename or directory path to create a full path, which you can then use in other statements. Using this method to define full paths helps ensure correct files and directories are located when scripts run on different computers where directory paths are likely different.
The following example creates a full path to a file in the directory that stores the open workspace or batch file the script is in.
fullFilePathInWorkspaceDir = CombinePaths(GetDirectory(QAWWorkspace), "Filename.extension")
The following example creates a full path to a file in the directory the script is in.
fullFilePathInScriptDir = CombinePaths(GetDirectory(QAWScript), "Filename.extension")
While less specific, you can also use relative paths to identify input and output files or directories in statements.
To locate files and directories identified by relative paths in scripts, QA Wizard Pro searches using the following methods when scripts run.
If a relative path references an: | These locations are searched in the following order: | If the file or directory is not found: |
---|---|---|
Input file | 1. Workspace or batch file2. Directory that stores the open workspace or batch file the script is in3. Directory the script is in | An error occurs |
Output file | 1. Workspace or batch file2. Directory that stores the open workspace or batch file the script is in | The file is created |
Input directory | 1. Directory that stores the open workspace or batch file the script is in2. Directory the script is in | An error occurs |
Output directory | Directory that stores the open workspace or batch file the script is in | The directory is created |