Hi,
since it appears that there is no such thing like a system command in PJSR, I have written a small PCL that allows to run shell commands from within PI. It just launches the command (for example some file converter, or a browser), and waits until the command returns. stdOut/stdErr are going to your terminal (not the PI-Console). SystemCommand considers an exit-code !=0 to indicate an error.
How to use: after installing the module, you can use it in 4 modes:
- Console Window: SystemCommand ls # launches the UNIX ls command
- PJSR scripts:
var pSystemCommand=new SystemCommand;
with (pSystemCommand) {
commandLine=sCommandLine;
}
pSystemCommand.executeGlobal();
- GUI: It can be found under Process/<etc>/SystemCommand. See Screenshot below.
- C++: Not for the faint of heart...
Currently this module works only on Linux-x64 (tested with Fedora11, but I don't expect difficulties with other Linuxes or FreeBSD), with the right makefiles (that are not difficult to create) it should also work on Linux-x32 or MacOS-X. It is probably a bit more difficult to get it running on Windows... . Maybe someone finds the time to convert it from UNIX's system() command to Qt's
QProcess (which makes it usable on Windows too), and also redirects stdOut/stdErr to the PI console. For my current purposes, it works fine...
Georg
PS: More recent version (that in theory also runs on Windows) also need the Qt4 development files for compilation. On Fedora 11, you can install them using the System>Administration>Add/Remove Software tool. Search for "qt-devel". The description of the package reads "Development Files for the Qt Toolkit". On Fedora 11, the package currently has the version "qt-devel-1:4.6.2-14.fc11(x86_64)". While the exact version is not critical, you need to make sure to install a QT4 package (qt-devel-1:4.6.2-14.fc11(x86_64)) for your architecure (here qt-devel-1:4.6.2-14.fc11(x86_64)).