Simpatie.ro - matrimoniale
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
BrianaS la Simpatie.ro
Femeie
23 ani
Bucuresti
cauta Barbat
26 - 57 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[JAVASCRIPT] JS Alternative to VBS for Creating an InputBox

Pagini: 1 Moderat de TRaP, TonyTzu
pus acum 1 luna#1
Mrrrr
AdMiN
Postari: 2388
To run .js files natively in Windows (like you would with a .vbs script), make sure it opens with Microsoft Windows Based Script Host by default.

The code below calls powershell (no admin required) and displays a simple InputBox:


var shell = WScript.CreateObject("WScript.Shell");

// Added -WindowStyle Hidden to prevent window flickering
var psCmd = "powershell -NoProfile -WindowStyle Hidden -Command \"[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic'); [Microsoft.VisualBasic.Interaction]::InputBox('Enter value:', 'Title')\"";

var exec = shell.Exec(psCmd);
var result = exec.StdOut.ReadAll().replace(/\r?\n|\r/g, "");

WScript.Echo("Result: " + result);


_______________________________________


 
   
Pagini: 1  
Mergi la