home *** CD-ROM | disk | FTP | other *** search
/ Our Birds: Texas / eViewer 3.9.iso / Thayer eField Guide Viewer v3.9.msi / Binary.NewBinary21 < prev    next >
Encoding:
Text File  |  2007-10-03  |  1.9 KB  |  78 lines

  1. Dim Fso
  2.  
  3. Function SetRavenLiteLocation()
  4.     On Error Resume Next
  5.  
  6.     Set fso = CreateObject ("Scripting.FileSystemObject")
  7.     If Err.Number <> 0 Then
  8.         MsgBox "Could not create Scripting.FileSystemObject."
  9.         Exit Function
  10.     End If
  11.  
  12.     Set drives = fso.Drives
  13.     If Err.Number <> 0 Then
  14.         MsgBox "Could not a list of drives on system."
  15.         Exit Function
  16.     End If
  17.  
  18.     For Each drive In drives
  19.         If drive.DriveType = 2 Then
  20.             location = "C:\Program Files\Raven Lite 1.0"
  21.             If IsRavenLiteAtLocation(location) Then
  22.                 Set folder = fso.GetFolder(location)
  23.                 Session.Property("RAVENLITELOCATION") = folder.Path
  24.             End If
  25.         End If
  26.     Next
  27. End Function
  28.  
  29. Function IsRavenLiteAtLocation(parent)
  30.     IsRavenLiteAtLocation = False
  31.  
  32.     Set folder = fso.GetFolder(parent)
  33.     If Not(folder Is Nothing) Then
  34.         path = fso.BuildPath(parent, "RavenLiteLauncher.exe")
  35.         Set file = fso.GetFile(path)
  36.         If Not (file Is Nothing) Then
  37.             IsRavenLiteAtLocation = True
  38.         Else
  39.             Set sf = f.SubFolders
  40.             For Each directory in sf
  41.                 If IsRavenLiteAtLocation(directory) Then
  42.                     IsRavenLiteAtLocation = True
  43.                 End If
  44.             Next
  45.         End If
  46.     End If
  47. End Function
  48.  
  49. Function SetMediaPath()
  50.     On Error Resume Next
  51.  
  52.     data = Split(Session.Property("CustomActionData"), "|")
  53.  
  54.     Set Conn = CreateObject("ADODB.Connection")
  55.     If Err.Number <> 0 Then
  56.         MsgBox "Could not create ADODB.Connection."
  57.         Exit Function
  58.     End If
  59.  
  60.     Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & data(0) & "Database\Database.mdb"
  61.     If Err.Number <> 0 Then
  62.         MsgBox "Could not open connection to database."
  63.         Exit Function
  64.     End If
  65.  
  66.     Conn.Execute "UPDATE MediaDirectory SET PrimaryPath='" & data(1) & "'"
  67.     If Err.Number <> 0 Then
  68.         MsgBox "Could not update the media path."
  69.         Exit Function
  70.     End If
  71.  
  72.     Conn.Close
  73.     If Err.Number <> 0 Then
  74.         MsgBox "Could not close the database connection."
  75.         Exit Function
  76.     End If
  77. End Function
  78.