exe2swf Tool script code implemented with VBS _VBS

Source: Internet
Author: User
Copy Code code as follows:

Dim asor,flashfilename
Set argobj = wscript.arguments

Dim positionstart,oked,tag,endsize
Positionstart = approximate number of bytes for player of 920000 ' Flash 4
Endsize = 8 ' exe file end byte number, other version can be set to 0
Flashfilename = argobj (0) ' Pass 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 = "00000000000000000708783" 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 filename
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 & "Would you like 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 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.