Board logo

标题: 粘帖党专用+[Code].vbs [打印本页]

作者: fastslz    时间: 2011-9-13 20:39     标题: 粘帖党专用+[Code].vbs

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

作者: wwenyunkui    时间: 2011-11-1 08:43

不好意思,没看明白,解释一下好吧




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2