I have been given an Executable to run as part of a script which will rename files in a folder, and I have to pass in the folder location as a parameter.
Rather than call it using a literal path, I wanted to use project variables, but this does not work.
In VB, a developer told me to use the following:
Shell "c:\<folder>\pdfnamer.exe \\servernamne\source1"
The first part is the location of the exe to be run and the second is the folder I want it to rename files in.
I have the two folders saved as project variables, so wanted to do something like this:
Shell "(Project.Variables.RenameCode)+"pdfnamer.exe" (Project.Variables.location1)"
But this does not work.
Can someone please tell me where I am going wrong?
Are you missing a +?
Therefore if I had:
Project.Variables.RenameCode = "C:\"
Project.Variables.location1 = "\\somePath"
Path = Project.Variables.RenameCode + "pdfnamer.exe " + Project.Variables.location1
Should create a String in the Path variable like this:
Note the space after the '.exe' otherwise there will be no space between the two paths1
In addition to that, please note that you need to replace each double quote symbol with two double quote symbols to make them appear in a VBScript string variable. For example:
Code: Log.Message("Test: ""My string"";")
Result: Test: "My string";
Allen - SmartBear Support
Thanks for your help guys.
I have now got this working as follows:
'1. Call the tested app PDF1 which points to the exe:
Set s1 = TestedApps.PDF1
'2. Supply the folder location as a command line parameter:
s1.Params.SimpleParams.CommandLineParameters = Chr(34) + Project.variables.Location1 + Chr(34)
'3. Run the executable:
set s2 = s1.run()
That Char(34) is a nice trick, I'll have to remember that [img]/images/graemlins/smile.gif[/img] its better than entering into 'Double Quote Hell'