xmldom下载者生成器代码(xmldown.hta)
来源: 阅读:1177 次 日期:2016-06-17 10:11:26
温馨提示: 小编为您整理了“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)).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>

<h4>1.生成下载用的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:createxml x(file1).value,x(pathname).value:if findfile(x(pathname).value) = true then msgbox(生成成功,请传到某个空间):x(url).innerhtml=<font color=red>生成成功,请传到某个空间</font>'> <br>

<h4>2.生成下载者</h4>

<button onclick='vbs:jsdown():if findfile(jsdown.js) = true then msgbox 生成成功:x(url).innerhtml=用法是cscript jsdown.js xmlurl savepath' >生成js下载者</button><button onclick='vbs:vbsdown():if findfile(vbsdown.vbs) = true then msgbox 生成成功:x(url).innerhtml=<font color=blue>用法是cscript vbsdown.js xmlurl savepath</font>'>生成vbs下载者</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());

do

{

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>

更多信息请查看脚本栏目
由于各方面情况的不断调整与变化, 提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 云南省教育厅备案号:云教ICP备0901021 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:
云南网警报警专用图标
Baidu
map