本帖最后由 fastslz 于 2011-9-13 21:00 编辑
- '粘帖党专用.vbs
- '剔除剪切板数据中每行右则多余空格字符
- '剔除剪切板数据中多余换行符
- '转换剪切板数据中Unix格式(CR)换行符为Windows(CR/LF)换行符。
- Set oie = CreateObject("internetexplorer.application")
- oie.Navigate("about:blank")
- Do Until oie.ReadyState = 4 : WScript.Sleep 200 : Loop
- vbstr = oie.Document.parentwindow.clipboarddata.getdata("text")
- If UBound(Split(vbstr,vbLf,-1,0)) = 0 Then vbstr=Replace(vbstr, vbCr, vbCrLf)
- If vbstr <> "" Then
- ary = Split(vbstr,vbCrLf,-1)
- For i = 0 To UBound(ary) - 1
- strOut = strOut & RTrim(ary(i)) & vbCrLf
- Next
- strOut = Replace(strOut,vbCrLf&vbCrLf&vbCrLf,vbCrLf)
- strOut = Replace(strOut,vbCrLf&vbCrLf,vbCrLf)
- oie.Document.parentwindow.clipboarddata.setdata "text", strOut
- End If
- oie.Quit
- Set oie = Nothing
复制代码
- '粘帖党专用+[Code].vbs
- '剔除剪切板数据中每行右则多余空格字符
- '剔除剪切板数据中多余换行符
- '转换剪切板数据中Unix格式(CR)换行符为Windows(CR/LF)换行符。
- '将剪切板数据Code括起来,方便论坛发贴
- Set oie = CreateObject("internetexplorer.application")
- oie.Navigate("about:blank")
- Do Until oie.ReadyState = 4 : WScript.Sleep 200 : Loop
- vbstr = oie.Document.parentwindow.clipboarddata.getdata("text")
- If UBound(Split(vbstr,vbLf,-1,0)) = 0 Then vbstr=Replace(vbstr, vbCr, vbCrLf)
- If vbstr <> "" Then
- ary = Split(vbstr,vbCrLf,-1)
- Lines = UBound(ary)
- For i = 0 To Lines - 1
- If i = 0 Then strOut = "[code]" & vbCrLf
- strOut = strOut & RTrim(ary(i)) & vbCrLf
- If i = Lines - 1 Then strOut = strOut & Chr(91)&Chr(47)&"code]" & vbCrLf
- Next
- strOut = Replace(strOut,vbCrLf&vbCrLf&vbCrLf,vbCrLf)
- strOut = Replace(strOut,vbCrLf&vbCrLf,vbCrLf)
- oie.Document.parentwindow.clipboarddata.setdata "text", strOut
- End If
- oie.Quit
- Set oie = Nothing
复制代码
|