Important: Please read the Qt Code of Conduct -

QSA Workbench - Win7 - Starting a .exe

  • Hello!

    I am working with QSA Workbench Version 1.1.5 and my OS is Windows 7 64bit. I am writing a little program and I am trying to figure out how to start a external program. I have looked through the 'help' database and I found the 'Process Class Reference' chapter. I have searched through the web and also this forum for my problem but I couldnt find a solution that was really helping me.

    What I want to do:
    All I want to do is start a .exe file with my little program. My problem is that I am not quite sure about the syntax etc... At the moment I am trying the following:
    @ var process = new Process();
    var path = "c:\Users\Blackbox\AppData\Roaming\MATLAB";
    process.workingDirectory = path;
    var arg = path + "\inverse.exe";

    I just dont know how to call the .exe file. Do I need the process ID (pid) of my .exe in order to start it? As you can see I am helpless right here. I appreciate any type of help...

    Thanks in advance!

  • Are you sure that the \ in the string doesn't need to be escaped? Usually, literal backslashes need to be doubled. Note that in Qt, you can use forward slashes internally everywhere on every platform.

  • Hey,

    thanks for your fast reply! Here is what I tried now:

    @var process = new Process();
    var path = "c://Users//Blackbox//AppData//Roaming//MATLAB//";
    process.workingDirectory = path;
    var arg = path + "inverse.exe";

    And here is the error log:
    @Error: loadflow : 183
    TypeError. No matching overload found. Following overloads are possible:
    loadflow(loadflow:183) (global context)@

    Note that loadflow is the name of my program. What am I doing wrong? I simply want to start the .exe.

  • Now you're doing both the doubling and the forward slash. It's either... or..., not both.

    I don't know much about QSA, so I can't help you with the actual method call. I have no idea where that is documented. I'd think that the QStringList is a list of arguments, and that you need some other way to set the path of the executable to run in the Process object, but I can't be sure about that without docs.

  • Finally, I got it.....

    Here is the working code:
    @var process = new Process();
    var arg = new Array();
    arg[0] = "inverse.exe";
    process.arguments = arg;

    Works just fine. Thanks for your help Andre!

Log in to reply