Page 1 of 1

Externes Programm starten

Posted: Tue Jan 14, 2014 1:24 pm
by andrew
Von einem QCAD/CAM Benutzer:
Ist es möglich, ein CAM-Script anzuweisen, zum Schluss ein weiteres (Windows-)Programm zu starten?

Re: Externes Programm starten

Posted: Tue Jan 14, 2014 1:37 pm
by andrew
Ja, Sie können zum Beispiel in der Funktion endExport das Qt API benutzen, um einen externen Prozess zu starten:

Beispiel Datei "scripts/Cam/CamConfigurations/LaunchExternalApp.js":
include("GCode.js");

function LaunchExternalApp(documentInterface, newDocumentInterface) {
    GCode.call(this, documentInterface, newDocumentInterface);
}

LaunchExternalApp.prototype = new GCode();


LaunchExternalApp.prototype.endExport = function() {
    GCode.prototype.endExport.call(this);

    // launch external application to display the file in a text editor:
    var process = new QProcess();
    var args = [ "-t", this.fileName ];
    process.start("/usr/bin/open", args);
}