首页 > 编程地带 > exe2swf的脚本代码

exe2swf的脚本代码

2007年10月4日 发表评论 阅读评论
<br />&#039;exe2swf工具,<br />&#039;用法:将exe格式的flash拖放在此文件上,即可生成swf文件,<br />&#039;haiwa@&#91;url&#93;http://www.51windows.Net&#91;/url&#93;<br />&#039;感谢jimbob提供帮助.dim AsoR,FlashFileName<br />Set ArgObj = WScript.Arguments<br /><br />dim PositionStart,OKed,Tag,EndSize<br />PositionStart = 920000&#039;flash 4的播放器的大致字节数<br />EndSize = 8    &#039;exe文件结尾字节数,其它版本可以设置为0<br />FlashFileName = ArgObj(0)&#039;传递路径<br /><br />set AsoR=CreateObject("Adodb.Stream")<br />AsoR.Mode=3 <br />AsoR.Type=1 <br />AsoR.Open <br />set AsoW=CreateObject("Adodb.Stream")<br />AsoW.Mode=3 <br />AsoW.Type=1 <br />AsoW.Open<br />AsoR.LoadFromFile(FlashFileName)<br /><br />OKed = true<br />dim filesize<br />filesize = AsoR.size<br /><br />if filesize>PositionStart then<br />   while OKed<br />       AsoR.Position = PositionStart<br />       Tag = Bin2Str(AsoR.read(20))<br />       if instr(Tag,"0000000") >0 then<br />           PositionStart = PositionStart + 1<br />       else<br />           PositionStart = PositionStart + 20<br />       end if<br />       if Tag = "00000000000000000708783" or Tag = "00000000000000000678783" then<br />           OKed = false<br />       end if<br />       &#039;if PositionStart > filesize then<br />       &#039;    OKed = false<br />       &#039;end if<br />   wend<br />else<br />   msgbox "文件错误"<br />end if<br />PositionStart = PositionStart + 16<br />&#039;msgbox PositionStart<br />AsoR.Position = PositionStart<br />AsoW.write AsoR.read(filesize-int(PositionStart)-int(EndSize))<br /><br />&#039;新文件名<br />dim newFileName<br />&#039;newFileName = left(FlashFileName,len(FlashFileName)-4) & ".swf"<br />newFileName = FlashFileName & ".swf"<br /><br />Set fso = CreateObject("Scripting.FileSystemObject")<br />If (fso.FileExists(newFileName)) Then<br />   overwrite = msgbox(newFileName&" 已存在"& vbnewline &"要替换它吗?",308,"文件已经存在 - exe2swf脚本")<br />   if overwrite=6 then<br />       AsoW.SaveToFile newFileName, 2<br />   else<br />       msgbox "操作被取消",0,"exe2swf脚本"<br />   end if<br />else<br />   AsoW.SaveToFile newFileName, 1<br />end if<br /><br />AsoR.close<br />set AsoR=nothing<br />AsoW.close<br />set AsoW=nothing<br /><br />Function Bin2Str(Bin)<br />   Dim I, Str<br />   For I=1 to LenB(Bin)<br />       clow=MidB(Bin,I,1)<br />       if ASCB(clow)<128 then<br />           Str = Str & (ASCB(clow))<br />       else<br />           I=I+1<br />           if I <= LenB(Bin) then Str = Str & (ASCW(MidB(Bin,I,1)&clow))<br />       end if<br />   Next <br />   Bin2Str = Str<br />End Function<br />

转载请注明:woyigui's blog [http://www.woyigui.cn/]
本文标题:exe2swf的脚本代码
本文地址:http://www.woyigui.cn/2007/10/04/exe2swf%E7%9A%84%E8%84%9A%E6%9C%AC%E4%BB%A3%E7%A0%81/

分类: 编程地带 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
*