VBS實現(xiàn)將字符串寫入剪切板的實現(xiàn)代碼,需要的朋友可以參考下。
函數(shù)代碼:
代碼如下:
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
'調(diào)用
代碼如下:
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"