Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt dialog in WSH using JScript?

How to open a prompt dialog box in WSH usig JScript??

The only pop-up dialog I've found in the doc is the WshShell.Popup() method. But I need a way to request the user to enter a string, like the window.prompt() method in DOM.

Thanks.

like image 835
GetFree Avatar asked Feb 10 '09 12:02

GetFree


1 Answers

I think the WScript object does not provide such a method however you can show an input box from vbscript running on WSH. So here is one possible solution which lets you call that VB function from within JS! Please note the file extension for the following code fragment ".wsf".

<!-- Test.wsf -->
<job id="InputBoxInJS">
   <script language="VBScript">
      Function VBInputBox(promptText)
        VBInputBox = InputBox(promptText)
      End Function
   </script>

   <script language="JScript">
      WScript.Echo("Hello from JScript")
      var x = VBInputBox("Enter text")
      WScript.Echo(x)
   </script>
</job>
like image 147
Autodidact Avatar answered Sep 19 '22 13:09

Autodidact