Results 1 to 5 of 5
  1. #1

    Calling an Exe using variables


    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?



  2. #2

    Re: Calling an Exe using variables

    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:
    "C:\pdfnamer.exe \\somePath"

    Note the space after the '.exe' otherwise there will be no space between the two paths1

  3. #3

    Re: Calling an Exe using variables

    Hi SJWUK,

    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

  4. #4

    Re: Calling an Exe using variables

    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()


  5. #5

    Re: Calling an Exe using variables

    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'



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 03:58 PM.

Copyright BetaSoft Inc.