龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VB开发 >

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

时间:2014-06-23 23:43来源: 作者: 点击:
分享到:
这篇文章主要介绍了通过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&""

精彩图集

赞助商链接