存为 hta- <HTA:APPLICATION SCROLL="no" />
- <title>自动保存</title>
-
- <script src=http://www.bathome.net/lib/diy/Function.js></script>
- <script src=http://www.bathome.net/lib/jquery.js></script>
-
- <script>
- var basetext = clipboardData.getData('text');
- var id = 0
-
- window.resizeTo(300,100)
-
- function start(){
- id = setInterval('autoSaveClipBoard()',100)
- $('button')[0].innerHTML = '单击开始保存'
- }
-
- function stop(){
- clearInterval(id)
- id=0
- $('button')[0].innerHTML = '单击停止保存'
- }
-
- function autoSaveClipBoard(){
- var cliptext = clipboardData.getData('text');
-
- if(basetext !== cliptext && /\S/.test(cliptext)){
- basetext = cliptext
-
- var title = basetext.replace(/^\s+/,'')
- .split(/\n/,1)[0].replace(/\s+$/g,'')
- .replace(/\\/g,'\')
- .replace(/\//g,'/')
- .replace(/:/g,':')
- .replace(/\*/g,'*')
- .replace(/\?/g,'?')
- .replace(/"/g,'"')
- .replace(/\</g,'《')
- .replace(/\>/g,'》')
- .replace(/\|/g,'|')
-
- save(basetext,title+'.txt',1)
-
- $('button')[0].innerHTML = '<pre>已保存:\n"'+title.replace(/&/g,'&')+'.txt"</pre>'
- }
- }
- </script>
-
- <body style='height:100%;margin:0px'>
- <button
- onclick='id?stop():start()'
- style='height:100%;width:100%;'>
- 单击开始保存
- </button>
- </body>
复制代码
|