exe2swf 工具(Adodb.Stream版)

來源:互聯網
上載者:User

Exe2swf ,將exe 格式的 flash檔案轉為swf 格式。網上有很多這方面的工具,這個是用vbscript寫的。
用法:
將下面代碼存為 exe2swf.vbs
將exe格式的flash拖放在此檔案上,即可產生swf檔案,
更新日期:2005-01-20 09:30 複製代碼 代碼如下:'exe2swf工具,
'用法:將exe格式的flash拖放在此檔案上,即可產生swf檔案,
'haiwa@http://www.51windows.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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.