Class Reference process

Executes software and scripts outside the LayoutEditor. More...


int execute(string command,stringList arguments)
bool externalTool(string path,string name,stringList parameter,string callback)
stringList getCommandlineParameter()
string getEnv(string parameter)
bool isLinux()
bool isMac()
bool isWindows()
int setEnv(string parameter,string value)
bool openBrowser(string url)
bool startDetached(string command,stringList arguments)
string startPythonScript(string filename,stringList args=stringList())
string startRubyScript(string filename,stringList args=stringList())
string startTclScript(string filename)
string toolResult()

Detailed Description

The process class contains several commands to control external software tools. The started tool can run independend of the LayoutEditor, or the execution of the macro can wait on the result of the external tool. Also an interfacev to start external LayoutScript is supported.

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 commandterminates 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.

#name=start bash script
#help=start bash script with callback macro

int main(){
 file f;
 string path=f.currentPath();
 stringList sl;
 if (process::externalTool("/bin","bash",sl,path+"/callback.layout")) {
   layout->showStatus("bash script started");
 } else {
   layout->showStatus("failed to start bash script");

static stringList process::getCommandlineParameter()

Returns: the commandline parameter the LayoutEditor was started with.

static string process::getEnv(string parameter)

Returns: the environment variable parameter

 layout->showMessage("your home path",process::getEnv("HOME"));

static bool process::isLinux()

Returns: true if the LayoutEditor was created for Linux

static bool process::isMac()

Returns: true if the LayoutEditor was created for Mac OSX

static bool process::isWindows()

Returns: true if the LayoutEditor was created for Microsoft Windows

static int process::setEnv(string parameter,string value)

set the environment variable parameter to value

static bool process::openBrowser(string url)

opens a browser with the url.

#name=open browser
#help=open browser with the LayoutEditor docmentation

int main(){
  if (!process::openBrowser("")){
      layout->showStatus("browser not found");
  return 0;

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.

static string process::startRubyScript(string filename,stringList args=stringList())

Starts a Ruby script with parameter args.

static string process::startTclScript(string filename)

Starts a TCL script.

static string process::toolResult()

Returns: the output to the command line, if the macro is a callback of an externalTool command (see above). In all other cases an empty string is returned.

#name=callback macro
#help=callback macro to show output in the TextEditor

int main(){
  string s=process::toolResult();
  if (s.size()>1){
      textEdit *te=project::getCentralTextEditor();
      if (te->drawing->text()!="") {
      te->drawing->title="Command Line Output";
  return 0;