How to show popup without browser

I need a warning type function to fix the error. I do not use a browser and use javascript as the goals of Windows administration. So their way to view the value of varibales if I do not use a browser?

+4
source share
7 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 connected to any application that supports the Windows Script host, such as Internet Explorer, Active Server Pages, etc. It also means that any application that supports Windows Script can use several languages ​​- JScript, VBScript, Perl, etc.

For reasons that I’m not sure about, but I believe that this is due to the fact that the DOM is not available outside the browser, the warning function is also not available outside the browser. To display a dialog box for the user in this case, you can use the following code:

WScript.Echo('The quick brown fox jumped over the lazy dog'); 
+6
source

If you want to use the 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 the jscript program using the wscript .

+2
source

In windows, you can use the Windows Script Host to execute your javascript. It has a built-in ability to draw output using Echo . However, there are some nuances, since WSH uses jscript, not javascript, although the languages ​​are similar.

+1
source

No with javascript. You can use the Visual Basic Script and MsgBox functions. No need to install anything.

 'In Hello.vbs. Comments starts with ' MsgBox "Hello there" 
0
source

You can create a simple file that will warn the text that is passed to it, for example, in python. I don't think there is any way to do this in Javascript, although without a browser.

0
source

Check out the HTA files. These file types let you run typical HTML / VBScript / JS code without the need for a browser. Just rename your HTML file to the HTA extension and run it. IT will display your β€œpage” and execute any JS. This type of file will give you access to other WScript functions, as well as file creation or access to AD, if necessary.

0
source

Summary of the differences between WScript.Echo and WshShell.Popup :

  • Windows scripts (vbs, js, wsf, etc.) can be run under one of two hosts: cscript.exe (command line) and wscript.exe (graphic). In the cscript section, WScript.Echo will create a line of text in the console window. WshShell.Popup will always display a message box even under cscript.
  • WshShell.Popup allows WshShell.Popup to specify the buttons, name and type of icons, for example, the VB / VBS MessageBox function. It also allows you to specify how long the message should remain open.
  • WScript.Echo allows WScript.Echo to pass multiple string arguments for output and will print them with separated spaces.
0
source

Source: https://habr.com/ru/post/1313715/


All Articles