Author Topic: Very cool rountine for you guys interested.  (Read 98 times)

cyberjedi

  • Sr. Member
  • ****
  • Posts: 267
    • View Profile
Very cool rountine for you guys interested.
« on: March 17, 2017, 11:41:39 am »
Function pReadFolder(pvrCurrentFolder, pvrJpgFolder)
Set pvrFso = CreateObject("Scripting.FileSystemObject")
Set pvrFolder = pvrFso.GetFolder(pvrCurrentFolder)
'------------------
' Read all the files in the current folder
'------------------
Set pvrFiles = pvrFolder.Files
For Each pvrFile in pvrFiles
'------------------
' It's an JPG, PNG, GIF, MKV, AVI, MP4, FLV, MP3   file; I add it to the table
'------------------
   If UCase(Right(pvrFile, 3)) = "JPG" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".JPG", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If

   If UCase(Right(pvrFile, 3)) = "PNG" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".PNG", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If

   If UCase(Right(pvrFile, 3)) = "GIF" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".GIF", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)   
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If

     If UCase(Right(pvrFile, 3)) = "MKV" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".MKV", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)   
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If
   
   
   If UCase(Right(pvrFile, 3)) = "AVI" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".AVI", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)   
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If
   
   
   If UCase(Right(pvrFile, 3)) = "MP4" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".MP4", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)   
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If
   
   
   If UCase(Right(pvrFile, 3)) = "FLV" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".FLV", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)   
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If
   
   
   If UCase(Right(pvrFile, 3)) = "MP3" Then
     pvrImage = Ucase(pvrFile)
      pvrImage = Replace(pvrImage, ".MP3", "")
     pvrLen = Len(pvrImage)
     pvrPos = InStrRev(pvrImage, "\")
      pvrRight = pvrLen - pvrPos
       pvrImage = LTrim(Right(pvrImage, pvrRight))
     pvrImage = " " & pvrImage & " "
     pvrImage = Replace(pvrImage," ","xx",1,-1,vbTextCompare)   
        HalBrain.AddToTable "pvrJpg", "Brain", pvrImage, pvrFile
   End If
   
   
   
   
Next
*****************
Think of it as a media codec for Hal
I use this for Dream Mode

best wishes
cyberjedi
« Last Edit: March 18, 2017, 12:52:31 am by cyberjedi »