Why can't I use WScript in aspx 
Author Message
 Why can't I use WScript in aspx

I am trying to use the WScript object in a jscript
function in my aspx app, but I get an error saying that
WScript is not defined.  Should I even be able to do this?

The line

    WScript.Sleep(100);

produces the error, but if I do

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

that works.  I would really like to use WScript in my aspx
application.  Can someone please explain to me how I can
do this?



Mon, 21 Feb 2005 00:02:46 GMT  
 Why can't I use WScript in aspx
well you have to instantiate it first, obviously. but why are you trying
to sleep an aspx script?

function String.prototype.r(){// Javascript rot13 en/decipherment. run
me for Atrax's signature
        var a='nopqrstuvwxyz';var b='abcdefghijklm';var j='/:.'+a+b;var
k='/:.'+b+a;var l='';
        for(var
x=0;x<this.length;x++){l+=k.charAt(j.indexOf(this.charAt(x)));}return l;

Quote:
}       alert("uggc://jjj.ernqgurshpxvatznahny.pb.hx/".r()); // Atrax, MVP

2002.

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



Mon, 21 Feb 2005 07:41:31 GMT  
 Why can't I use WScript in aspx

Quote:

> I am trying to use the WScript object in a jscript
> function in my aspx app, but I get an error saying that
> WScript is not defined.  Should I even be able to do this?

> The line

>     WScript.Sleep(100);

> produces the error, but if I do

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

> that works.  I would really like to use WScript in my aspx
> application.  Can someone please explain to me how I can
> do this?

The WScript object isn't creatable - it's only available when wscript/cscript.exe hosts the script engine...

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



Mon, 21 Feb 2005 11:53:09 GMT  
 Why can't I use WScript in aspx
Why not just use built-in functionality...of course I could be missing
something here...maybe why it is necessary to sleep in a server app or why
it is neccessary to use a COM object trick?  Ok here goes...

// begin DoMagic! -- and you getting paid to write this, hopefully? :-o
Import System.Threading;

{...}

Thread.CurrentThread.Sleep(100);

{...}
// end DoMagic!

Here in lies situationally similar functionality w/o the COM interaction
necessity, which adds complexity to the application or in this case the web
application maintenance and does not add any appreciable value.

Shame on the developer that adds COM functionality where .NET functionality
previously exists a priori, since COM interaction adds 30+ method
marshalling and instantiation calls to a singular request.  Think managed
first!  I will bet 20 to one that there is a design pattern or at least a
fairly straight forward way to accomplish many of the hacks that we as
developers have had to live with in the unmanaged world now available in the
managed BCL or CLR if you like.  If your response includes QueryInterface()
or CoInitialize(), I will summarily e-slap you.

Taking bets now,

Kirk A. Viehland



Quote:

> I am trying to use the WScript object in a jscript
> function in my aspx app, but I get an error saying that
> WScript is not defined.  Should I even be able to do this?

> The line

>     WScript.Sleep(100);

> produces the error, but if I do

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

> that works.  I would really like to use WScript in my aspx
> application.  Can someone please explain to me how I can
> do this?

The WScript object isn't creatable - it's only available when
wscript/cscript.exe hosts the script engine...

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



Sat, 12 Mar 2005 12:38:51 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Can't call a vbscript sub from ASPX html

2. Using ASP and WSH to Print on Your Intranet (Why doesn't it work)

3. Why why why why?

4. i need help with 'wscript.run'

5. Error: object required: 'WScript'

6. i need help with 'wscript.run'

7. Object required: 'Wscript'

8. WScript is 'Undefined' error

9. Two Q's [Closing a file][why won't work]

10. Why WScript.CreateObject()

11. WHY, WHY, WHY!!!!!

12. Using 'Word = WScript.CreateObject("Word.Application");'

 

 
Powered by phpBB® Forum Software