WScript.shell run method returns before the program starts! 
Author Message
 WScript.shell run method returns before the program starts!

Hello

Im using WScript.shell to start a program from a hta application. When
i launch my code I see the program's startup screen but before the
actual application starts the method returns and nothing happens.

I have tried starting other programs with the same code and it works.
And basically my code works because i can see the startup screen.
Here is the code:

var cmd = constants['MAME32_PATH'] + " " + roms[index];
var fs = new ActiveXObject('WScript.Shell');
fs.run(cmd,1,true);

(cmd is: D:/PROGRA~1/MAME32/MAME32.EXE romname)

If i click [run] in the startmenu and type the exact same command
(cmd) it works as it is supposed to. What could be wrong?



Mon, 30 Aug 2004 02:52:33 GMT  
 WScript.shell run method returns before the program starts!
If this is a console mode program, try this just for debugging...

fs.run("%comspec% /k "+cmd,1,true);

You might be getting an error that disappears too fast to see...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> Hello

> Im using WScript.shell to start a program from a hta application. When
> i launch my code I see the program's startup screen but before the
> actual application starts the method returns and nothing happens.

> I have tried starting other programs with the same code and it works.
> And basically my code works because i can see the startup screen.
> Here is the code:

> var cmd = constants['MAME32_PATH'] + " " + roms[index];
> var fs = new ActiveXObject('WScript.Shell');
> fs.run(cmd,1,true);

> (cmd is: D:/PROGRA~1/MAME32/MAME32.EXE romname)

> If i click [run] in the startmenu and type the exact same command
> (cmd) it works as it is supposed to. What could be wrong?



Mon, 30 Aug 2004 05:52:01 GMT  
 WScript.shell run method returns before the program starts!
Hi, thanks for the reply!
I tried your code but it only pops up a MS-DOS prompt window and nothing
else happens. I dont even see the startup screen as I did before. Do I
have to write anything else than:
<pre>
fs.run("%comspec% /k "+cmd,1,true);
<pre>
<br>
Im running Windows ME. The program I'm trying to launch (mame32) is a
windows32 application and takes a filename(romname)as parameter. Mame32
is an emulator and should start the romname specified in fullscreen
mode.
<br>
If I use this code:
<pre>
err = fs.run(cmd, 1, true);
alert(err);
</pre>
Err is 1. I don't know if that helps?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 30 Aug 2004 19:27:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Wscript.Shell Run method and ntvdm.exe

2. Does WScript.Shell Run method have a maxlength?

3. Is it a BUG with Run method of WScript.Shell

4. Wscript.Shell run method

5. Run programs by Wscript.shell

6. Wscript.Shell RemoteInvoke Method

7. Wscript.Shell Exec method

8. using WSH to start shell programs from ie4

9. Run WSH logon script before NT shell starts?

10. WScript.Shell.Run does not pass back errorlevels?

11. Problem running WScript.Shell from asp

12. wscript.shell in .asp to run ftp script

 

 
Powered by phpBB® Forum Software