xmldom下載者生成器代碼(xmldown.hta)
來源:易賢網(wǎng) 閱讀:1308 次 日期:2016-06-17 10:11:26
溫馨提示:易賢網(wǎng)小編為您整理了“xmldom下載者生成器代碼(xmldown.hta)”,方便廣大網(wǎng)友查閱!

以下代碼保存成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>

更多信息請查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:xmldom下載者生成器代碼(xmldown.hta)
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機(jī)號
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報警專用圖標(biāo)