Posted by israelb in SWF Studio V3 on Jul 10 2008, 08:47 pm

hi....this is my problem:

my file .bat content echo and executed in windows display echo.....but in executed dont see echo in window.

i need see echo

this is my code:

ssCore.Shell.execute({path: "startdir://file.bat", saveStdOut:"true", winState:"hidden"});

help me....please....thnks


Posted by northcode in SWF Studio V3 on Jul 10 2008, 09:51 pm

Do you mean you don't see the echo on the screen or you don't see the stuff you echo in the saved output?

You have to be careful not to use any "special" characters in the folder name or or the name of the BAT file you're trying to execute or it won't work as expected.

According to CMD.EXE, a special character is one of the following: &<>()@^|

I can't think of an easy way to get around that issue right now, but I'll keep trying.

If you need a test case that works, this code will let you execute a BAT file and get the results so you can see where things are going wrong. Just drop this code into a new FLA and run it (after changing the path to point to your BAT file).


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

ssCore.Win.show({});

var r  = ssCore.SysInfo.getEnv({variable:"COMSPEC"});

if (r.success)
{
   comspec = r.result;

else
{
   ssCore.App.showMsgBox({prompt:"could not read COMSPEC environment variable"});
   ssCore.App.quit({});
}

var quote = "\"";

// this is where you put the fully qualified path to the BAT file you want to run
var bat = "c:\\test.bat";

var r = ssCore.Shell.execute({path:comspec, arguments:"/c " + quote + bat + quote, saveStdOut:"true"});

if (r.success)
{
   ssCore.App.showMsgBox({prompt:r.output});
}
else
{
   ssCore.App.showMsgBox({prompt:"could not execute " + args});
   ssCore.App.quit({});
}
If that's still not working for you then we'll need more details lilke the name of the BAT file, the path where the BAT file is being run from and what you're trying to do in the BAT file.


Posted by israelb in SWF Studio V3 on Jul 11 2008, 10:07 am

hi....I try your code i see window from swf studio, but my bat window dont see the "echo"....

this is image window bat run out in swf studio:

[ATTACH]1439[/ATTACH]

this my code in bat file:

@Echo Off
cls
Echo Buscando Actualizaciones (espere un momento)...
Echo Nota: Este proceso requiere acceso a Internet.
Echo Este proceso requiere privilegios de administrador.
updater.exe -checkforupdates

if %errorlevel%==1 Call :WshPopup "Hay una nueva actualizacion disponible, ?Quiere descargarla ahora?" 60 "Grupo Educare" 36
if not %errorlevel%==1 goto FIN

Goto :EOF
:WshPopup
cls
Echo Actualizaciones detectadas...
Set Amp=&
If %Amp%'==' Set Amp=^^^&
Echo Set oSh = WScript.CreateObject("WScript.Shell")>_SHPOPU0.VBS
Echo Ret = oSh.Popup(%1,%2,%3,%4)>>_SHPOPU0.VBS
Echo WScript.Echo "Set Ret=" %Amp% Ret>>_SHPOPU0.VBS

CScript //Nologo //I _SHPOPU0.VBS > _SHPOPU0.BAT

Call _SHPOPU0.BAT
Del _SHPOPU0.*
IF %ret%==6 goto actualiza
IF not %ret%==6 goto FIN
GOTO FIN
Goto :EOF

:actualiza
cls
Echo Actualizando Software de Grupo Educare.
Echo Espere a que el proceso haya finalizado.
Updater.exe -smartsequenced
GOTO FIN
GOTO :EOF

:FIN
EXIT
CLS
GOTO :EOF


Posted by northcode in SWF Studio V3 on Jul 11 2008, 11:05 am

The first three ECHO commands are showing up...


Echo Buscando Actualizaciones (espere un momento)...
Echo Nota: Este proceso requiere acceso a Internet.
Echo Este proceso requiere privilegios de administrador.


So if the other ECHO commands aren't showing up, it's probably because you are skipping over them.

If errorlevel is not 1 then the next few lines in your BAT file guarantee that there will be no output.


if %errorlevel%==1 Call :WshPopup "Hay una nueva actualización disponible, ¿Quiere descargarla ahora?" 60 "Grupo Educare" 36
if not %errorlevel%==1 goto FIN

Goto :EOF
Before you tell me that it's impossible for the errorlevel to be anything but 1, change your code to look like this and se what gets displayed.


echo errorlevel is %errorlevel%

if %errorlevel%==1 Call :WshPopup "Hay una nueva actualización disponible, ¿Quiere descargarla ahora?" 60 "Grupo Educare" 36

echo testing errorlevel (thinking about quitting)
if not %errorlevel%==1 goto FIN

echo definitely quitting now
Goto :EOF