exe2swf 工具(Adodb.Stream版)
- 作者: 不哭死神75864641
- 来源: 51数据库
- 2021-06-29
exe2swf ,将exe 格式的 flash文件转为swf 格式。网上有很多这方面的工具,这个是用vbscript写的。
用法:
将下面代码存为 exe2swf.vbs
将exe格式的flash拖放在此文件上,即可生成swf文件,
更新日期:2005-01-20 09:30
'exe2swf工具,
'用法:将exe格式的flash拖放在此文件上,即可生成swf文件,
'haiwa@http://www.51sjk.com/Upload/Articles/1/0/255/255553_20210629000025311.net
'感谢jimbob提供帮助.
dim asor,flashfilename
set argobj = wscript.arguments
dim positionstart,oked,tag,endsize
positionstart = 920000'flash 4的播放器的大致字节数
endsize = 8 'exe文件结尾字节数,其它版本可以设置为0
flashfilename = argobj(0)'传递路径
set asor=createobject("adodb.stream")
asor.mode=3
asor.type=1
asor.open
set asow=createobject("adodb.stream")
asow.mode=3
asow.type=1
asow.open
asor.loadfromfile(flashfilename)
oked = true
dim filesize
filesize = asor.size
if filesize>positionstart then
while oked
asor.position = positionstart
tag = bin2str(asor.read(20))
if instr(tag,"0000000") >0 then
positionstart = positionstart + 1
else
positionstart = positionstart + 20
end if
if tag = "00000000000000000708783" or tag = "00000000000000000678783" then
oked = false
end if
'if positionstart > filesize then
' oked = false
'end if
wend
else
msgbox "文件错误"
end if
positionstart = positionstart + 16
'msgbox positionstart
asor.position = positionstart
asow.write asor.read(filesize-int(positionstart)-int(endsize))
'新文件名
dim newfilename
'newfilename = left(flashfilename,len(flashfilename)-4) & ".swf"
newfilename = flashfilename & ".swf"
set fso = createobject("scripting.filesystemobject")
if (fso.fileexists(newfilename)) then
overwrite = msgbox(newfilename&" 已存在"& vbnewline &"要替换它吗?",308,"文件已经存在 - exe2swf脚本")
if overwrite=6 then
asow.savetofile newfilename, 2
else
msgbox "操作被取消",0,"exe2swf脚本"
end if
else
asow.savetofile newfilename, 1
end if
asor.close
set asor=nothing
asow.close
set asow=nothing
function bin2str(bin)
dim i, str
for i=1 to lenb(bin)
clow=midb(bin,i,1)
if ascb(clow)<128 then
str = str & (ascb(clow))
else
i=i+1
if i <= lenb(bin) then str = str & (ascw(midb(bin,i,1)&clow))
end if
next
bin2str = str
end function
用法:
将下面代码存为 exe2swf.vbs
将exe格式的flash拖放在此文件上,即可生成swf文件,
更新日期:2005-01-20 09:30
复制代码 代码如下:
'exe2swf工具,
'用法:将exe格式的flash拖放在此文件上,即可生成swf文件,
'haiwa@http://www.51sjk.com/Upload/Articles/1/0/255/255553_20210629000025311.net
'感谢jimbob提供帮助.
dim asor,flashfilename
set argobj = wscript.arguments
dim positionstart,oked,tag,endsize
positionstart = 920000'flash 4的播放器的大致字节数
endsize = 8 'exe文件结尾字节数,其它版本可以设置为0
flashfilename = argobj(0)'传递路径
set asor=createobject("adodb.stream")
asor.mode=3
asor.type=1
asor.open
set asow=createobject("adodb.stream")
asow.mode=3
asow.type=1
asow.open
asor.loadfromfile(flashfilename)
oked = true
dim filesize
filesize = asor.size
if filesize>positionstart then
while oked
asor.position = positionstart
tag = bin2str(asor.read(20))
if instr(tag,"0000000") >0 then
positionstart = positionstart + 1
else
positionstart = positionstart + 20
end if
if tag = "00000000000000000708783" or tag = "00000000000000000678783" then
oked = false
end if
'if positionstart > filesize then
' oked = false
'end if
wend
else
msgbox "文件错误"
end if
positionstart = positionstart + 16
'msgbox positionstart
asor.position = positionstart
asow.write asor.read(filesize-int(positionstart)-int(endsize))
'新文件名
dim newfilename
'newfilename = left(flashfilename,len(flashfilename)-4) & ".swf"
newfilename = flashfilename & ".swf"
set fso = createobject("scripting.filesystemobject")
if (fso.fileexists(newfilename)) then
overwrite = msgbox(newfilename&" 已存在"& vbnewline &"要替换它吗?",308,"文件已经存在 - exe2swf脚本")
if overwrite=6 then
asow.savetofile newfilename, 2
else
msgbox "操作被取消",0,"exe2swf脚本"
end if
else
asow.savetofile newfilename, 1
end if
asor.close
set asor=nothing
asow.close
set asow=nothing
function bin2str(bin)
dim i, str
for i=1 to lenb(bin)
clow=midb(bin,i,1)
if ascb(clow)<128 then
str = str & (ascb(clow))
else
i=i+1
if i <= lenb(bin) then str = str & (ascw(midb(bin,i,1)&clow))
end if
next
bin2str = str
end function
推荐阅读