Dim swfDir
Dim swfName
msgbox" This program will automatically update vital program files." & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "At the next screen, please select the Updated SWF file!",0,"SWF Updater"
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "SWF Files|*.swf"
ObjFSO.FilterIndex = 1
ObjFSO.InitialDir = ".\"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
Wscript.Echo "You didn't select a file!!!"
Wscript.Quit
Else
msgbox"We will now begin a search for the original file..." & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "This may take a few moments... Please Wait!" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "If you recieve a McAfee warning, Select..." & Chr(13) & Chr(10) & "'Allow entire script this time'" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "...To continue with the program!",0,"Ready To Search!"
FileNameArray=Split(ObjFSO.FileName,"\")
swfName = FileNameArray(UBound(FileNameArray))
End If
'Search Function
sCmd = "cmd /c dir c:" & swfName & "/s /b "
Set shell = createobject("wscript.shell")
Set d = CreateObject("Scripting.Dictionary")
Set wsx = shell.exec(sCmd)
Set wsxOut = wsx.stdout
Do: wscript.sleep 10
Do until wsxOut.atendofstream
d(d.count) = wsxOut.readline
Loop
Loop until wsx.status <> 0 And wsxOut.atendofstream
For Each filepath in d.items()
msgbox"swffile found in: " & Chr(13) & Chr(10) & Chr(13) & Chr(10) & filepath & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "We will now apply the Updated SWF!!!",0,"File Found!!!"
swfDir = filepath
Set swfExe = CreateObject("Scripting.FileSystemObject")
If swfExe.FileExists(filepath & "BACKUP") Then
Wscript.Echo "The updated SWF appears to already be installed!!!" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "No files were modified!!!"
Wscript.Quit
Else
Set RenameObject = CreateObject("Scripting.FileSystemObject")
RenameObject.MoveFile filepath , filepath & "BACKUP"
msgbox"Your original file has been backed up...",0,"Important!"
'Copy Function
Set FileObject = CreateObject("Scripting.FileSystemObject")
FileObject.CopyFile ObjFSO.FileName, swfDir
End If
Next
Set origExe = CreateObject("Scripting.FileSystemObject")
If origExe.FileExists(swfDir) Then
msgbox"All Done!!! " & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "You can now play the swf without the CD in the drawer!!!" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "
[email protected]",0,"All Done!"
Else
msgbox"You don't appear to have Kryopit installed!" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Please install Kryopit and then run this program again!!!",0,"File Error!"
End If