Posted by BGoulette in SWF Studio V3 on Jun 01 2008, 05:52 pm

I realize it's still the weekend and that most people probably have better things to do than read my posts, but I have another question...

As I've stated elsewhere, I'm currently using a different product that's just not doing what I need it to do; one of the things it does do, however, is it lets me start a new process and keep track of its id, then, with an ENTER_FRAME event, determine if that process is still open or not and respond accordingly.

Can SwfStudio do the same thing with Shell.execute or Shell.invoke (or Shell.whatever)? And if so, how? I'm brand-spanking new to Swf Studio -- sort of evaluating it while I'm trying to un-screw myself thanks to this other product :mad: -- and I'm still trying to wrap my head around how it "works." (I've been poring over the help files, but I'll admit, some of the example code isn't all that helpful to me, and I'm pretty good with AS3 :( ) I'd appreciate any insight. Thanks!


Posted by AGo in SWF Studio V3 on Jun 01 2008, 06:01 pm

have a look at ssCore.Shell.execute.

You can use the ( waitForWindow XOR waitForExit ) flag, depending if you are only interested in checking when the application quits or if you actually need the hwnd and pid.

In both cases you would want to use it async, e.g. like this


function onAppQuit (r,e,c) {
if (r.success) {
//notepad was started and closed successfull
} else {
//notepad was not able to be started
ssDebug.trace(r.Error.description);
};
}
ssCore.Shell.execute({path:"windows://notepad.exe", waitForExit:"true"},{callback:onAppQuit});


(code not tested and compiled so it might contain syntax errors, it´s late overhere ;) )


Posted by BGoulette in SWF Studio V3 on Jun 01 2008, 06:26 pm

Late or not, that example set me on the right path! I very much appreciate it! And to be honest, SWF Studio's solution is much more elegant (IMO) than the other product I was using...I like being able to explicitly listen for an event rather than having to run an ENTER_FRAME event checking the changing value of some flag!

I think the more I mess around with SWF Studio, the more I'm gonna like it... ;)


Posted by northcode in SWF Studio V3 on Jun 01 2008, 10:59 pm

If you get "homesick" for the old way of doing things :) or you run into a situation where you need a different approach, Shell.execute also returns the process id (pid) of the new process and you can monitor that with SysInfo.getWindowList, where the pid is returned along with the other window info.