批处理之家's Archiver

fastslz 发表于 2011-9-13 20:39

粘帖党专用+[Code].vbs

[i=s] 本帖最后由 fastslz 于 2011-9-13 21:00 编辑 [/i]

[code]'粘帖党专用.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][code]
'粘帖党专用+[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
[/code]

wwenyunkui 发表于 2011-11-1 08:43

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

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.