Process Class Reference
Executes programs and scripts outside the LayoutEditor. More...
See also: List of Classes
Member
- execute(string command,stringList arguments)
- externalTool(string path,string name,stringList parameter,string callback)
- getCommandlineParameter()
- getEnv(string parameter)
- isLinux()
- isMac()
- isWindows()
- setEnv(string parameter,string value)
- startDetached(string command,stringList arguments)
- startPythonScript(string filename,stringList args=stringList())
- startRubyScript(string filename,stringList args=stringList())
- startTclScript(QString filename)
- toolResult()
Detailed Description
The process class is used to start external programs. A detached program start will result in a parallel processing of the external program. A normal start will wait with the macro execution until the external program terminates.
Also reading and writing environment variable can be done with this class.
Member Function Documentation
static int process::execute(string command,stringList arguments)
command is executed with the given arguments. It waits until command terminates and the exit code is returned. If arguments is a string it is split on spaces to a stringList.
static bool process::externalTool(string path,string name,stringList parameter,string callback)
searches and executes the tool name with parameter. path is a hint where to find the tool. callback macro is called as soon the tool finished. The method will return immediately and does not wait until the started tool terminated. true is return, if the tool was started successfully.
static stringList process::getCommandlineParameter()
Returns: the commandline parameter the LayoutEditor was started with. (introduced with version 20151211)
static string process::getEnv(string parameter)
Returns: the environment variable parameter
static bool process::isLinux()
Returns: true if the LayoutEditor was created for Linux (introduced with version 20141015)
static bool process::isMac()
Returns: true if the LayoutEditor was created for Mac OSX (introduced with version 20141015)
static bool process::isWindows()
Returns: true if the LayoutEditor was created for Microsoft Windows (introduced with version 20141015)
static int process::setEnv(string parameter,string value)
set the environment variable parameter to value
static bool process::startDetached(string command,stringList arguments)
command is executed with arguments. It returns true if the program launch was successful. If arguments is a string it is split on spaces to a stringList.
static string process::startPythonScript(string filename,stringList args=stringList())
Starts a Python script with parameter args. (Introduced with version 20170429)
static string process::startRubyScript(string filename,stringList args=stringList())
Starts a Ruby script with parameter args. (Introduced with version 20170429)
static string process::startTclScript(QString filename)
Starts a TCL script. (Introduced with version 201700506)
static string process::toolResult()
Returns: the command line output, if the macro is a callback of an externalTool command (see above). In all other cases an empty string is returned.