Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 270 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WScript.Sleep() ~ WSScript is undefined

#1
I'm trying to follow some example code from microsofts mdn site..

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

while (oExec.Status == 0)
{
WScript.Sleep(100);
}

WScript.Echo(oExec.Status);

I'm currently writing a javascript/JScript to run a few batch commands. Everything works fine if I don't use WScript.Sleep(). However, If i try to use it, to prevent locking up the browser, i'm getting an error that WScript is not defined.

I figured that I needed to define it myself. However, I have been searching mdn website all day with no luck. This is my first time using any "windows only" products I could be coompletly overlooking something.

If you want to see the documentation I'm looking through it is located here.

[To see links please register here]


Any help is greatly appreciated.

Thanks,
Freddy
Reply

#2
`WScript` is an object that is defined when the Javascript is run within the Windows Script Host, aka WSH. The object is not available within the Javascript engine in a web browser.

If you are really trying to produce "batch like" files, then you don't need a browser, and I'd say you probably don't want a browser. You can write your code into a .js file and just run it from the cmd.exe prompt or Explorer window with a double-click.



Reply

#3
Change the script language from JavaScript to JScript
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through