Understanding exe2swf tools
This article mainly explains "understanding exe2swf tools". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "understanding exe2swf tools".
Exe2swf, convert the flash file in exe format to swf format. There are many tools for this on the Internet, and this is written in vbscript.
Usage:
Save the following code as exe2swf.vbs
Drag and drop flash in exe format on this file to generate a swf file
Last Update at: 2005-01-20 09:30
The code is as follows:
'The exe2swf tool
Usage: drag and drop flash in exe format on this file to generate swf file
'haiwa@ http://www.51windows.Net
Thank you jimbob for your help.
Dim AsoR,FlashFileName
Set ArgObj = WScript.Arguments
Dim PositionStart,OKed,Tag,EndSize
PositionStart = approximate number of bytes of the player for 920000'flash 4
EndSize = 8 'bytes at the end of the exe file, other versions can be set to 0
FlashFileName = ArgObj (0) 'delivery path
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 = "0000000000000000000708783" or Tag = "00000000000000000678783" then
OKed = false
End if
'if PositionStart > filesize then
'OKed = false
'end if
Wend
Else
Msgbox "File error"
End if
PositionStart = PositionStart + 16
'msgbox PositionStart
AsoR.Position = PositionStart
AsoW.write AsoR.read (filesize-int (PositionStart)-int (EndSize))
'New file name
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& "already exists" & vbnewline & "do you want to replace it?", 308, "File already exists-exe2swf script")
If overwrite=6 then
AsoW.SaveToFile newFileName, 2
Else
Msgbox "Operation canceled", 0, "exe2swf script"
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 iTun1 to LenB (Bin)
Clow=MidB (Bin,I,1)
If ASCB (clow)