Posted by markotomic in SWF Studio V3 on May 25 2011, 09:39 pm

Hi,

Is there a way to launch a child (file1.exe) file from internal:// path if it is bundled in the main app. See attachment.

Thanks

attachments: Screen shot 2011-05-26 at 11.42.32 AM.png  


Posted by northcode in SWF Studio V3 on May 25 2011, 09:44 pm

The "+" sign on the icon for both files means they will automatically be extracted to the application temp folder when the EXE starts.

to launch file.exe you would do this...


ssCore.Shell.execute({path:"tempdir://file1.exe"});
Note: If the file was not marked as "AutoExtract" you would have to extract it (somewhere) before you could launch it.


Posted by markotomic in SWF Studio V3 on May 26 2011, 12:41 am

Thanks, that works great.
Also wondering if there is a way to notify the parent app when file1.exe is opened/colsed?

I tried using:

ssCore.Shell.setNotify({event:"onShellExecuteFeedback"}, {callback:onFeedback});
But onFeedback() wasn't getting anything. Perhaps I'm subscribing to a wrong event?


Posted by northcode in SWF Studio V3 on May 26 2011, 12:07 pm

The onShellExecuteFeedback event is used when you specify the saveStdOut flag. It allows you to get the data written to stdout in chunks instead of getting it all at once when the app is finished. The documentation has been updated in 3.9 but was missing from 3.8. Here's what you're missing.

name - onShellExecuteFeedback
type - triggered
result - "data"

The onShellExecuteFeedback event is triggered when an application you started with Shell.execute using the saveStdOut flag writes data to standard output. The data receievd by the event handler is application specific and will be broken into chunks with a maximum size of 4K.


ssCore.App.setNotify({event:"onShellExecuteFeedback"}, {callback:onFeedback});

function onFeedback(ret_obj, cb_obj, err_obj)
{
    if (ret_obj.success)
    {
        ssDebug.trace(ret_obj.result);
    }



Now, that's still not very useful. If you want to be notified when an app is open or when it ends you can just call ssCore.Shell.execute asynchronously and use the waitForWindow or waitForExit flags. You can only use one though, your callback will either be called when the window appears or when the app ends.

If you use waitForExit and the app takes "too long" to complete you might see the "script is running slowly" message from Flash. There is a way around this but you'll have to send us an email to get a copy of the System plugin. It has a replacement for Shell.execute that gets around that limitation. If the app runs and exits quickly this won't be an issue for you.