使用JScript在WSH中提示对话框? [英] Prompt dialog in WSH using JScript?

查看:97
本文介绍了使用JScript在WSH中提示对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在WSH usig JScript中打开提示对话框?

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

我在文档中找到的唯一弹出对话框是WshShell.Popup()方法.但是我需要一种方法来请求用户输入字符串,例如DOM中的window.prompt()方法.

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.

谢谢.

推荐答案

我认为WScript对象不提供这种方法,但是您可以显示在WSH上运行的vbscript的输入框.因此,这里是一种可能的解决方案,可让您从JS内调用该VB函数!请注意以下代码片段".wsf"的文件扩展名.

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>

这篇关于使用JScript在WSH中提示对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆