home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Main
- Wscript.Quit 0
-
-
- Sub Main()
-
- 'Declare objects
-
- Dim wsh 'As Wscript.Shell
- Dim fs 'As Scripting.FileSystemObject
- Dim tsScript 'As Scripting.TextStream
- Dim f
- Dim WshSysEnv 'As WshEnvironment
-
- 'Declare variables
-
- Dim strUserName 'As String
- Dim strPassword 'As String
- Dim strRemoteSite 'As String
- Dim strRemoteDirectory 'As String
- Dim strLocalDirectory 'As String
- Dim strWindowsFolder 'As String
- Dim strTempFolder 'As String
- Dim strSystemFolder 'As String
- Dim strFtpScriptFileName 'As String
- Dim strsDatFile 'As String
- Dim strDatFile 'As String
- Dim strFTPDir 'As String
- Dim intWindowStyle 'As Integer
- Dim theOS 'As String
-
- 'Define constants
-
- Const TemporaryFolder = 2
- Const WindowsFolder = 0
- Const SystemFolder = 1
- Const WshHide = 0
- Const WshNormalFocus = 1
- Const WshMinimizedFocus = 2
- Const WshMaximizedNoFocus = 3
- Const WshNormalNoFocus = 4
- Const WshMinimizedNoFocus = 6
-
- intWindowStyle = WshNormalFocus
-
-
- Set wsh = CreateObject("Wscript.Shell")
- Set fs = CreateObject("Scripting.FileSystemObject")
- strWindowsFolder = fs.GetSpecialFolder(WindowsFolder)
- strSystemFolder = fs.GetSpecialFolder(SystemFolder)
- strTempFolder = fs.GetSpecialFolder(TemporaryFolder)
- Set WshSysEnv = wsh.Environment("SYSTEM")
- theOS=WshSysEnv("OS")
-
- '=============================================================
- 'zde nastavte pot°ebnΘ parametry
- strPassword = "user@home.cz" 'FTP server password
- strUserName = "anonymous" 'FTP server user name
- strRemoteSite = "ftp.mcafee.com" 'FTP server machine name
- strRemoteDirectory = "/pub/antivirus/datfiles/4.x/" 'FTP server top directory you are synchronizing
- strLocalDirectory = "c:\temp" 'LOCAL directory musφ existovat
-
- strsDatFile="sdat.txt"
- strDatFile="dat.txt"
-
- ' ============================================================
- 'FTP-slo₧ka je nezßvislß na OS
- If theOS ="Windows_NT" Then
- strFTPDir= strSystemFolder
- Else
- strFTPDir= strWindowsFolder
- End If
-
-
- strFtpScriptFileName = fs.BuildPath(strTempFolder, fs.GetBaseName(Wscript.ScriptFullName) & ".script")
- '
-
- Set tsScript = fs.CreateTextFile(strFtpScriptFileName, True)
- tsScript.WriteLine "open " & strRemoteSite
- tsScript.WriteLine strUserName
- tsScript.WriteLine strPassword
- tsScript.WriteLine "cd " & strRemoteDirectory
- tsScript.WriteLine "prompt"
- tsScript.WriteLine "lcd "& strLocalDirectory
- tsScript.WriteLine "ls dat*.zip "& strDatFile
- tsScript.WriteLine "ls sdat*.exe " & strsDatFile
- tsScript.WriteLine "bye"
- tsScript.Close
- Set tsScript = Nothing
-
- 'Start FTP pomocφ skriptu
- 'wsh.Run strFTPDir & "\ftp.exe -s:""" & strFtpScriptFileName & """", intWindowStyle, True
-
- Set f=fs.OpenTextFile( strLocalDirectory & "\" & strDatFile,1)
- If fs.FileExists( strLocalDirectory &"\" & Trim(f.Readline)) Then
- wsh.Popup "Novou verzi ji₧ mßte sta₧enou.", 60
- WScript.Quit
- End If
- WScript.Quit
- 'Druh² skript pro p°enos soubor∙
- Set tsScript = fs.CreateTextFile(strFtpScriptFileName, True)
- tsScript.WriteLine "open " & strRemoteSite
- tsScript.WriteLine strUserName
- tsScript.WriteLine strPassword
- tsScript.WriteLine "cd " & strRemoteDirectory
- tsScript.WriteLine "hash"
- tsScript.WriteLine "bin"
- tsScript.WriteLine "prompt"
- tsScript.WriteLine "lcd "& strLocalDirectory
- tsScript.WriteLine "mget dat*.zip"
- tsScript.WriteLine "mget sdat*.exe"
- tsScript.WriteLine "bye"
- tsScript.Close
- Set tsScript = Nothing
-
- 'SpuÜt∞nφ FTP pro p°enos soubor∙
- wsh.Run strFTPDir & "\ftp.exe -s:""" & strFtpScriptFileName & """", intWindowStyle, True
-
- 'ZjiÜt∞nφ nßzv∙ soubor∙ a spuÜt∞nφ updatu McAfee
- 'VÜechna hlßÜenφ se uklßdajφ do souboru sdatlog.txt
- Set f=fs.OpenTextFile( strLocalDirectory & "\" & strsDatFile,1)
- wsh.Run strLocalDirectory & "\" & f.ReadLine & " /silent /LOGFILE "& strLocalDirectory &"\sdatlog.txt"
- f.Close
-
- End Sub