(Newbie) Help needed 
Author Message
 (Newbie) Help needed

 I'm new to scripting and it seems that I didn't grasp something elementary.
 The following sample code :

    <script language="JScript">

         var WshShell      =  new ActiveXObject ("WScript.Shell");
         var  FileSysObject = new ActiveXObject
("Scripting.FileSystemObject");

        WshShell.Run("D:\\my_prog.exe");
        WScript.Echo("Done");

    </script>

returns the error "WScript is undefined" although as a script (*.wsh) it
causes no
problem (using WScript.CreateObject instead of new ActiveXObject. Why do I
have to change this at all ? )
I'm using Jscript 5.5 + WSH 2.0 + MS Script De{*filter*} 1.0a.
I'll appreciate any help. Thanks.



Sat, 04 Oct 2003 04:10:50 GMT  
 (Newbie) Help needed
WScript IS undefined (nowhere in your code do you have a variable/object
named WScript) so JavaScript doesn't know what to do with it.

The WScript object is assigned to the variable 'WshShell'. Perhaps you can
use WshShell.Echo ("Done"); (I don't know cos I haven't ever had to do
this).

Chris barber.


Quote:
> I'm new to scripting and it seems that I didn't grasp something
elementary.
>  The following sample code :

>     <script language="JScript">

>          var WshShell      =  new ActiveXObject ("WScript.Shell");
>          var  FileSysObject = new ActiveXObject
> ("Scripting.FileSystemObject");

>         WshShell.Run("D:\\my_prog.exe");
>         WScript.Echo("Done");

>     </script>

> returns the error "WScript is undefined" although as a script (*.wsh) it
> causes no
> problem (using WScript.CreateObject instead of new ActiveXObject. Why do I
> have to change this at all ? )
> I'm using Jscript 5.5 + WSH 2.0 + MS Script De{*filter*} 1.0a.
> I'll appreciate any help. Thanks.



Sat, 04 Oct 2003 03:14:29 GMT  
 (Newbie) Help needed
Just an FYI, this whole problem (repeated and "solved" on another thread in another NG) all revolved
around not knowing how to debug WSH hosted scripts.  The OP was "porting" his WSH hosted scripts
into IE to debug them since he knew how to do *that* kind of script debugging.

Once he found out how to enable WSH 2.0 script debugging, it all became a moot point ;-)...!!!

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> WScript IS undefined (nowhere in your code do you have a variable/object
> named WScript) so JavaScript doesn't know what to do with it.

> The WScript object is assigned to the variable 'WshShell'. Perhaps you can
> use WshShell.Echo ("Done"); (I don't know cos I haven't ever had to do
> this).

> Chris barber.



> > I'm new to scripting and it seems that I didn't grasp something
> elementary.
> >  The following sample code :

> >     <script language="JScript">

> >          var WshShell      =  new ActiveXObject ("WScript.Shell");
> >          var  FileSysObject = new ActiveXObject
> > ("Scripting.FileSystemObject");

> >         WshShell.Run("D:\\my_prog.exe");
> >         WScript.Echo("Done");

> >     </script>

> > returns the error "WScript is undefined" although as a script (*.wsh) it
> > causes no
> > problem (using WScript.CreateObject instead of new ActiveXObject. Why do I
> > have to change this at all ? )
> > I'm using Jscript 5.5 + WSH 2.0 + MS Script De{*filter*} 1.0a.
> > I'll appreciate any help. Thanks.



Sat, 04 Oct 2003 04:55:20 GMT  
 (Newbie) Help needed
I see what you mean after re-reading the thread. I initially didn't see the
case that the script was being ported from a remote / wsc / wsh routine (and
as such would be able to create and run apps).

Sometimes it's a little difficult to see the intention of the posted issue.
In this case, I saw the error, not the underlying root cause (moving script
across engines and platforms).

Thanks for your input Michael.

Chris Barber.


Quote:
> Just an FYI, this whole problem (repeated and "solved" on another thread

in another NG) all revolved
Quote:
> around not knowing how to debug WSH hosted scripts.  The OP was "porting"

his WSH hosted scripts
Quote:
> into IE to debug them since he knew how to do *that* kind of script
debugging.

> Once he found out how to enable WSH 2.0 script debugging, it all became a

moot point ;-)...!!!
Quote:

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --



> > WScript IS undefined (nowhere in your code do you have a variable/object
> > named WScript) so JavaScript doesn't know what to do with it.

> > The WScript object is assigned to the variable 'WshShell'. Perhaps you
can
> > use WshShell.Echo ("Done"); (I don't know cos I haven't ever had to do
> > this).

> > Chris barber.



> > > I'm new to scripting and it seems that I didn't grasp something
> > elementary.
> > >  The following sample code :

> > >     <script language="JScript">

> > >          var WshShell      =  new ActiveXObject ("WScript.Shell");
> > >          var  FileSysObject = new ActiveXObject
> > > ("Scripting.FileSystemObject");

> > >         WshShell.Run("D:\\my_prog.exe");
> > >         WScript.Echo("Done");

> > >     </script>

> > > returns the error "WScript is undefined" although as a script (*.wsh)
it
> > > causes no
> > > problem (using WScript.CreateObject instead of new ActiveXObject. Why
do I
> > > have to change this at all ? )
> > > I'm using Jscript 5.5 + WSH 2.0 + MS Script De{*filter*} 1.0a.
> > > I'll appreciate any help. Thanks.



Sat, 04 Oct 2003 06:37:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Newbie help needed

2. Newbie help needed with a Logon Script

3. Help needed, urgent-- newbie need GS+GV for PC

4. Ghostscript 8.00 and Redmon - Newbie needs help

5. Newbie needs help: PS to ASCII Text

6. Newbie Need help

7. javascript newbie needs help.

8. newbie needs help

9. newbie needs graphic inserting help

10. newbie needs help: cant view all pages

11. Newbie needs help printing

12. Newbie needs help!

 

 
Powered by phpBB® Forum Software