' Outline.vbs ' Generic Outline of new ' Program loader ' Filenames and paths based on Efficiency Reporter Dim oShell, oFSO, cExe, cLocal, cRemote, cSetup, cStem, oRemote Set oFSO = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("WScript.Shell") cStem = "Eff_Rpts" cExe = cStem & ".exe" cSetup = cStem & ".sup" cLocal = "C:\VFPLocal\" cRemote = "I:\Foxwin\Launch\" If NewerFile(cLocal & cSetup, cRemote & cSetup) Then ' Run the setup RunSetup cLocal & cSetup, cRemote & cStem Else ' Check to make sure the install has been run If Not IsInstalled() Then ' Not installed RunSetup cLocal & cSetup, cRemote & cStem Else If NewerFile(cLocal & cExe, cRemote & cExe) Then oRemote = oFSO.GetFile cRemote & cExe oRemote.CopyFile cLocal End If oShell.Run(cLocal & cExe & cParameters) End If End If Private Function NewerFile(tcLocalFile, tcRemoteFile) ' Determines if the local file is older than the remote ' Returns True if local file doesn't exist ' Returns False if remote doesn't exist Dim oFSO, oLocal, oRemote Set oFSO = CreateObject("Scripting.FileSystemObject") If Not oFSO.FileExists(tcLocalFile) Then NewerFile = True Else If Not oFSO.FileExists(tcRemoteFile) Then NewerFile = False Else oLocal = oFSO.GetFile(tcLocalFile) oRemote = oFSO.Getfile(tcRemoteFile) NewerFile = (oRemote.DateLastModified > oLocal.DateLastModified) End if End If End Function Private Sub RunSetup(tcTextFile, tcRemotePath) ' Creates a new setup text file and then runs the setup program Dim oFSO, oShell, oTest Set oFSO = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("WScript.Shell") ' Write File Set oText = oFSO.CreateTextFile(tcTextFile, True) oText.Close ' Run setup oShell.Run(tcRemotePath & "\Setup.exe /Q") End Sub Private Function IsInstalled Dim oShell, cKey, cValue Set oShell = CreateObject("WScript.Shell") cKey = "HKCR\VisualFoxPro.Runtime\CLSID\" On Error Resume Next cValue = oShell.RegRead(cKey) IsInstalled = (cValue > "") End Function