VBS实现将字符串写入剪切板的实现代码
(编辑:jimmy 日期: 2024/11/15 浏览:3 次 )
函数代码:
复制代码 代码如下:
Sub CopyString(s)
Set forms=WScript.CreateObject("forms.form.1")
Set textbox=forms.Controls.Add("forms.textbox.1").Object
With textbox
.multiline=True
.text=s
.selstart=0
.sellength=Len(.text)
.copy
End With
End Sub
'调用
复制代码 代码如下:
CopyString " www.jb51.net"
完整测试代码
复制代码 代码如下:
Sub CopyString(s)
Set forms=WScript.CreateObject("forms.form.1")
Set textbox=forms.Controls.Add("forms.textbox.1").Object
With textbox
.multiline=True
.text=s
.selstart=0
.sellength=Len(.text)
.copy
End With
End Sub
CopyString " www.jb51.net"
msgbox "ok"
复制代码 代码如下:
Sub CopyString(s)
Set forms=WScript.CreateObject("forms.form.1")
Set textbox=forms.Controls.Add("forms.textbox.1").Object
With textbox
.multiline=True
.text=s
.selstart=0
.sellength=Len(.text)
.copy
End With
End Sub
'调用
复制代码 代码如下:
CopyString " www.jb51.net"
完整测试代码
复制代码 代码如下:
Sub CopyString(s)
Set forms=WScript.CreateObject("forms.form.1")
Set textbox=forms.Controls.Add("forms.textbox.1").Object
With textbox
.multiline=True
.text=s
.selstart=0
.sellength=Len(.text)
.copy
End With
End Sub
CopyString " www.jb51.net"
msgbox "ok"
下一篇:从XML文件中获取信息的vbs代码