vbs实现的保存剪贴板中的文本并编辑或保存

保存剪贴板中的文本.vbs

原理就是首先判断是否存在同名文件,存在就名字后面+1,然后将剪贴板的内容保存到自定义扩展名的文件里


set fso=createobject("scripting.filesystemobject") : name=1
Dim na
na=Inputbox("请输入拓展名:","拓展名","txt")
while fso.fileexists(name&"."&na)=true
name=name+1
wend
set o=fso.opentextfile(name&"."&na,2,true)
set hf=Createobject("htmlfile")
wind=hf.parentwindow.clipboarddata.getdata("text")
o.writeline wind : o.close

保存剪贴板中的文本并编辑.vbs


set fso=createobject("scripting.filesystemobject") : name=1
Dim na
na=Inputbox("请输入拓展名:","拓展名","txt")
while fso.fileexists(name&"."&na)=true
name=name+1
wend
set o=fso.opentextfile(name&"."&na,2,true)
set hf=Createobject("htmlfile")
wind=hf.parentwindow.clipboarddata.getdata("text")
o.writeline wind : o.close
createobject("wscript.shell").exec "notepad.exe "&name&"."&na&""