gpt4 book ai didi

vbscript - 如何使用 vbscript 在一个用户表单中创建多个输入框

转载 作者:行者123 更新时间:2023-12-02 01:06:13 24 4
gpt4 key购买 nike

我正在尝试使用 vbscript 在一个用户表单中创建多个输入框,而不是一次显示一个输入框,我想一次显示多个输入框,然后从所有输入框输入,但也无法在互联网上找到任何解决方案。
在我的代码中,第二个输入框是在从第一个输入框输入之后出现的,反之亦然,我想使用 vbscript 一次获取所有输入,而不是 vba

sInput = InputBox("Enter your name")

MsgBox ("You entered:" & sInput)

sInput1 = InputBox("Enter your Age")

MsgBox ("You entered:" & sInput1)

sInput2 = InputBox("Enter email id you want to send")
sInput3 = InputBox("Enter Subject")
sInput4 = InputBox("Enter Email Body")

最佳答案

我从@omegastripes multiline_inputbox_via_hta.vbs 找到了一个 vbscript 代码

不知道这个回答能不能给你个思路?

dim completed

msgbox inputboxml("Enter text:", "Multiline inputbox via HTA", "Enter your name : " & vbcrlf & "Enter your Age : " & vbcrlf &_
"Enter email id you want to send : " & vbcrlf & "Enter Subject : " & vbcrlf & "Enter Email Body : " )

function inputboxml(prompt, title, defval)
set window = createwindow()
completed = 0
defval = replace(replace(replace(defval, "&", "&amp;"), "<", "&lt;"), ">", "&gt;")
with window
with .document
.title = title
.body.style.background = "buttonface"
.body.style.fontfamily = "consolas, courier new"
.body.style.fontsize = "8pt"
.body.innerhtml = "<div><center><nobr>" & prompt & "</nobr><br><br></center><textarea id='hta_textarea' style='font-family: consolas, courier new; width: 100%; height: 400px;'>" & defval & "</textarea><br><button id='hta_cancel' style='font-family: consolas, courier new; width: 85px; margin: 10px; padding: 3px; float: right;'>Cancel</button><button id='hta_ok' style='font-family: consolas, courier new; width: 85px; margin: 10px; padding: 3px; float: right;'>OK</button></div>"
end with
.resizeto 550, 550
.moveto 100, 100
end with
window.hta_textarea.focus
set window.hta_cancel.onclick = getref("hta_cancel")
set window.hta_ok.onclick = getref("hta_ok")
set window.document.body.onunload = getref("hta_onunload")
do until completed > 0
wscript.sleep 10
loop
select case completed
case 1
inputboxml = ""
case 2
inputboxml = ""
window.close
case 3
inputboxml = window.hta_textarea.value
window.close
end select
end function

function createwindow()
rem source http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
dim signature, shellwnd, proc
on error resume next
signature = left(createobject("Scriptlet.TypeLib").guid, 38)
do
set proc = createobject("WScript.Shell").exec("mshta ""about:<head><script>moveTo(-32000,-32000);</script><hta:application id=app border=dialog minimizebutton=no maximizebutton=no scroll=no showintaskbar=yes contextmenu=no selection=yes innerborder=no icon=""%windir%\system32\notepad.exe""/><object id='shellwindow' classid='clsid:8856F961-340A-11D0-A96B-00C04FD705A2'><param name=RegisterAsBrowser value=1></object><script>shellwindow.putproperty('" & signature & "',document.parentWindow);</script></head>""")
do
if proc.status > 0 then exit do
for each shellwnd in createobject("Shell.Application").windows
set createwindow = shellwnd.getproperty(signature)
if err.number = 0 then exit function
err.clear
next
loop
loop
end function

sub hta_onunload
completed = 1
end sub

sub hta_cancel
completed = 2
end sub

sub hta_ok
completed = 3
end sub

关于vbscript - 如何使用 vbscript 在一个用户表单中创建多个输入框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47385300/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com