已经好了,非常感谢 yu2n 坛友- ' 延时
- WScript.Sleep 3000
-
- Dim wso, objHTML, strClipboardText
- Set wso = CreateObject("Wscript.Shell")
- Set objHTML = CreateObject("htmlfile")
- strClipboardText = objHTML.ParentWindow.ClipboardData.GetData("text")
-
- '测试
- 'strClipboardText = "测试 A1 + C2 = 100% ? "
-
- ' 方法一:直接 Ctrl + V
- wso.SendKeys "^v"
- wso.SendKeys "~"
-
- ' 方法二:拆分成单个字符发送,只支持按键字符(A-z,0-9,英文标点),会受输入法限制
- Dim i, strKey
- If Not strClipboardText = "" Then
- For i = 1 To Len(strClipboardText)
- ' 拆分成单个字符
- strKey = Mid(strClipboardText, i, 1)
- WScript.Sleep 300
- ' 判断字符是否支持
- If ASCW(strKey) > 0 And ASCW(strKey) < 127 Then
- '' 特殊符号 + ^ % ~ 的处理
- If InStr("+^%~", strKey) > 0 Then strKey = "{" + strKey + "}"
- '' 发送按键码
- wso.SendKeys strKey
- End If
- Next
- End If
-
- Set wso = Nothing
- Set objHTML = Nothing
复制代码
|