How to use vbs to implement exe2swf tool
Editor to share with you how to use vbs to achieve the exe2swf tool script code, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The code is as follows:
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)