本帖最后由 0000 于 2017-9-3 12:47 编辑
觉得非常实用!
这代码风格......- @echo off
-
- >%tmp%\qr_getdata.vbs (
- echo Set objHTML=CreateObject("htmlfile"^)
- echo ClipboardText=objHTML.ParentWindow.ClipboardData.GetData("text"^)
- echo If VarType(ClipboardText^)^<^>8 Or ClipboardText=Empty Then
- echo MsgBox "请复制一些内容再运行本程序!",vbOKOnly + vbExclamation,"警告"
- echo WScript.Quit
- echo End If
- echo Set fso=WScript.CreateObject("scripting.filesystemobject"^)
- echo Set file=fso.OpenTextFile("%tmp%\qr_data.txt",2,true^)
- echo file.WriteLine ClipboardText
- echo WScript.Quit
- )
- call %tmp%\qr_getdata.vbs
- if not exist %tmp%\qr_data.txt goto :eof
-
- >%tmp%\qr_UrlEncode.js (
- echo var str=encodeURIComponent(WScript.Arguments(0^)^);
- echo WScript.echo(str^);
- )
-
- >%tmp%\qr_urlcode.txt (
- for /f "usebackq delims=" %%i in ("%tmp%\qr_data.txt") do (
- cscript -nologo %tmp%\qr_UrlEncode.js "%%i"
- ) )
-
- for /f %%i in (%tmp%\qr_urlcode.txt) do (
- set n=%%i
- call set m=%%m%%%%n%%%%%%0A
- )
-
- >%tmp%\indexqr.html (
- echo ^<html^>
- echo ^<head^>
- echo ^<title^>二维码生成^</title^>
- echo ^<script language=javascript^>
- echo function hero(^){
- echo var herowidth=400;
- echo var heroheight=450;
- echo window.resizeTo(herowidth,heroheight^)
- echo }
- echo hero(^);
- echo ^</script^>
- echo ^<script language=javascript^>^</script^>
- echo ^<style type="text/css"^>
- echo body{
- echo overflow-x:hidden;
- echo overflow-y:hidden;
- echo text-align:center;
- echo }
- echo ^</style^>
- echo ^</head^>
- echo ^<body style="background:#C7C7C7" onresize=hero(^); onkeypress=window.close(^) ^>
- echo ^<p style="text-align:center"^>
- echo ^<img
- echo border="1"
- echo width="350"
- echo height="350"
- echo alt="按任意键关闭窗口"
- echo src="http://pan.baidu.com/share/qrcode?w=350&h=350&url=%m%"
- echo ^>
- echo ^</p^>
- echo ^<p style="text-align:center"^>
- echo ^<b^>By.DcrClub^</b^>
- echo ^</p^>
- echo ^</body^>
- echo ^</html^>
- )
-
- start mshta "%tmp%\indexqr.html"
- del /f/q %tmp%\qr_* >nul 2>nul
- goto :eof
复制代码
|