非常基本的问题。我有一个VBScript,要求提供计算机ID,然后返回其序列号。我的问题是返回是在消息框而不是文本字段中,因此您无法复制+粘贴返回的序列号。
MsgBox "The serial number for the specified computer is: " & SN.SerialNumber
对VBscript不太了解 - 但我想有一种方法可以将这个数字放在文本字段中,这样任何人都可以复制+粘贴它。
由于
答案 0 :(得分:4)
实际上,您可以复制MsgBox
显示的文本(至少在Windows Vista上)。只需单击 Ctrl + C ,您将在剪贴板中获得以下内容:
--------------------------- --------------------------- The serial number for the specified computer is: foobar --------------------------- OK ---------------------------
答案 1 :(得分:2)
如果你想在像MsgBox这样的弹出窗口中使用它,请使用InputBox:
Dim tmp
tmp = InputBox("The serial number for the specified computer is:",,SN.SerialNumber)
答案 2 :(得分:0)
只需在页面上放置一个文本框并为其指定ID,然后使用VBScript设置该字段的属性,如下所示:
Set myTextBox = Item.UserProperties.Find("myTextBoxFieldID")
myTextBox.Value = "The serial number for the specified computer is: " & SN.SerialNumber
答案 3 :(得分:0)
添加此项,它会将序列号的输出复制到剪贴板:
'Copy output to clipboard
sText = SN.Serialnumber
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "about:blank"
Do Until objIE.ReadyState=4: WScript.Sleep 1: Loop
objIE.Document.ParentWindow.ClipboardData.SetData "Text", sText
objIE.Quit