Page 1 of 1

callSystem as a separate process? (WIN)

Posted: October 14th, 2010, 8:04 am
by berniebernie
Hello scripters

I'm using system.callSystem to launch a frame-cycler (djv view in my case) but I can't figure out how to launch the application without having AE hanging waiting for me to close the window.

In windows I know that you can use 'start app-path.exe' to launch a new process, but I can't seem to make it work with AE..

The code works, but waits until the viewer windows is closed.

Code: Select all

var imViewer = ((app.settings.haveSetting("test", "imviewerr")))?(app.settings.getSetting("test", "imviewerr")):"";
vpath = imViewer;
viewer = new File(vpath);
if(viewer.exists){
    cmd = "cmd /c \""+escapeWin(pathToWinPath(vpath))+"\"";
    system.callSystem(cmd);
}else{
    viewer = File.openDialog ("Choose an image viewer (like djv view). This dialog will only appear once", "");
    app.settings.saveSetting("test", "imviewerr",viewer.path+"/"+viewer.name);
}
// working call    system.callSystem("cmd /c \"C:\\Program Files (x86)\\djv 0.8.2\\bin\\djv_view.exe\""); 
 
function pathToWinPath(path){
	str = path.replace(/\//, "");
	str = str.replace(/\//, ":/");
	str = str.replace(/%20/g, " ");
	str = str.replace(/\//g, "\\");
	return str;
}
function escapeWin(string){
    str = string.replace(/\\/g,"\\\\");
    return str
}
Any ideas?

Thanks!

Re: callSystem as a separate process? (WIN)

Posted: December 6th, 2010, 5:32 pm
by francoisgfx
I believe should try START /B app.exe to do that.
If it doesnt work, just write a batch file in the temp folder via script and then fire it w/ the systemcall

it should work I think