Prompt dialog in WSH using JScript?

后端 未结 2 1361
暖寄归人
暖寄归人 2021-02-19 14:21

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

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-19 14:35

    I know this question has been answered, but I wouldn't want to use the .wsf stuff and I also wouldn't want the overhead of loading internet explorer (as I've seen other solutions do). I found this solution using Google that I think is the most elegant:

    http://with-love-from-siberia.blogspot.com/2009/12/msgbox-inputbox-in-jscript.html

    The key is using the ActiveXObject "ScriptControl", setting the language to VBScript and then using the ScriptObject.eval() function. The example on the site stands on its own.

    EDIT: For those encountering an error with 64 bit or line feed, etc., there's this improved version with instructions on how to run it (on systems like Win7 x64) here.

提交回复
热议问题