Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a popup without a browser

I need an "alert" type feature to troubleshoot an error. I am not using a browser and using javascript as windows administaration purposes. So is their a way to view a varibales value if I am not using a browser?

like image 595
Luke101 Avatar asked Dec 17 '22 23:12

Luke101


2 Answers

JScript is a scripting language based on the ECMAScript standard.

JScript is implemented as a Windows Script engine. This means that it can be plugged in to any application that supports the Windows Script host, such as Internet Explorer, Active Server Pages, etc. It also means that any application supporting Windows Script can use multiple languages — JScript, VBScript, Perl, and others.

For reasons that I am not sure about, but I believe it to be related to the fact the the DOM is not available outside the browser, the alert function is also not available outside the browser. In order to popup a dialog box to the user in this case you can use the following code:

WScript.Echo('The quick brown fox jumped over the lazy dog');
like image 144
Bruno DeGoia Avatar answered Dec 31 '22 10:12

Bruno DeGoia


If you want a windows GUI popup, then:

var timeout = 0;
var buttons = 0;  // OK
var icon = 48; // Exclamation

var shell = new ActiveXObject("WScript.Shell");
shell.Popup("text ...", timeout, "window title", buttons + icon);

and run your jscript program with the wscript command.

  • Microsoft JScript language reference.
  • Popup documentation.
like image 28
glenn jackman Avatar answered Dec 31 '22 09:12

glenn jackman