How to open a prompt dialog box in WSH usig JSacript??
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.
How to open a prompt dialog box in WSH usig JSacript??
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.
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>
There is also WshShell.Popup, which is accessible from VBScript and JScript. It also seems quite a bit more flexible than VBScript's built-in stuff.