Posted by cartographe in SWF Studio V3 on Oct 19 2011, 06:59 pm

Hello,

I am trying to build a "quit and restart" function into an application so that it can clear its memory on occasion. It works fine on Win7 but fails on XP.

//restarting application
ssCore.Shell.open({path:ssGlobals.ssExePath});
setInterval(function (){ ssCore.App.quit();},1000);


The Win 7 machine restarts the program seamlessly, but XP just quits.

Is it security? path? lack of Flash plugin?

Any help someone can offer would be great! Unfortunately I don't have access to the XP machine so it is difficult to debug.

Thanks


Posted by maxxp in SWF Studio V3 on Oct 19 2011, 10:43 pm

Looks good to me, no issues with any of my xp machines.
This might be an issue that is machine specific.

When you say "fail", does the application quit but not restart?
Does the shell.open command fire but the app.quit one doesnt work?
Does it run at all?
Does it crash?


Posted by cartographe in SWF Studio V3 on Oct 20 2011, 12:17 am

The client reports that the original application quits and a new instance doesn't start.

When you say machine specific what possibilities come to mind?


Posted by northcode in SWF Studio V3 on Oct 20 2011, 01:50 am

Hi Eric,

We've been having a bit of back and forth on this via email but I'd like to continue that here in case anyone else is having the same issue.

I see something different with the EXE you sent me so I'm going to create a simple test app that we can play with so we're all on the same page and we don't have to share any


Posted by northcode in SWF Studio V3 on Oct 20 2011, 02:38 am

Okay, my quick test app fails on XP with Shell.open or Shell.execute the same way that you describe with 3.8.

However, the exact same code works fine in 3.9 so something got fixed but I don't see anything in the known problems list that would account for that so it was something subtle - I'm guessing related to a handle to the original file that we were keeping open or something.

If you look at the result of your ssCore.Shell.open/execute call, you'll see that it's actually generating an error.

Instead of trying to launch the EXE itself, I've made a simple example (attached) that launches a BAT file called "restart.bat" instead. The BAT file launches the EXE so there's no blocking going on and everything just works.

The code now looks like this (below) so the restart.bat file needs to be in the same folder as the app you're working with and that should get you up and running using SWF Studio 3.8.


ssCore.init();
ssDefaults.synchronousCommands = true;

restart_btn.addEventListener(MouseEvent.CLICK, onClicked);

function onClicked(e:MouseEvent):void
{
   ssCore.Shell.execute({path:ssGlobals.ssStartDir+"\\restart.bat", winState:"hidden"},{sync:false});
   setInterval(function (){ ssCore.App.quit();}, 1000);
}

attachments: restart.zip  


Posted by cartographe in SWF Studio V3 on Oct 21 2011, 07:11 pm

Great! Apparently this worked like a charm on the client's machine.

Your help is a godsend. Thanks northcode!


Posted by maxxp in SWF Studio V3 on Jun 02 2012, 06:03 pm

Just an FYI, I experienced this as well today.
Another workaround that seems to work is to compile the exe with the shell.execute command on an XP machine.

Strangest thing, compiling it on a win7 machine with 3.8 wont allow it to shell.exec on an XP machine, but, compiling on an XP machine will work on both win7 and XP.


Posted by northcode in SWF Studio V3 on Jun 02 2012, 08:01 pm

If you're using the same version of SWF Studio and the same SWFs in both cases then where you compile should make absolutely no difference.

The compiler and it doesn't use anything from the build machine except for the files that it put there. There *might* be a case in the compiler where it does something different on XP vs. Win7 but in all cases it uses the exact same player engine and SWF.

So while it's highly unlikely that the build machine has anything to do with the problem you're seeing I'd like to see (a) if you can reproduce your results with 3.9 and if you can (b) if I can reproduce your results using your test files.


Posted by maxxp in SWF Studio V3 on Jun 05 2012, 05:46 pm


QUOTE: from northcode;53955
If you're using the same version of SWF Studio and the same SWFs in both cases then where you compile should make absolutely no difference.

The compiler and it doesn't use anything from the build machine except for the files that it put there. There *might* be a case in the compiler where it does something different on XP vs. Win7 but in all cases it uses the exact same player engine and SWF.

So while it's highly unlikely that the build machine has anything to do with the problem you're seeing I'd like to see (a) if you can reproduce your results with 3.9 and if you can (b) if I can reproduce your results using your test files.


Unfortunately, reproducing the issue in 3.9 isnt an option since 3.9 seems to work.

It seems to be an issue with the version 3.8 (i think 333 from your latest release when I ask for a registered download link).

You are correct in the machine not being associated with the issue.
Specifically, we created the shell.exec file on win7 3.8 and it runs fine. Copying that file to ANY machine results in the shell.exec failing, seems as it only works on the compiled machine.
We then copied the swf over to a windows XP machine, (running 3.6) compiled it and the shell.exec function worked.

After updating to 3.9, everything works fine.


Posted by northcode in SWF Studio V3 on Jun 05 2012, 10:39 pm

I'm happy if you're happy :)