VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. Currently I run a VBSCRIPT against my recorded shows to encode to wmv.
    What I am doing is checking a folder for files and then encode them. That works fine.

    I currently am checking the output folder to make sure file was not encoded already. This works except when I move a file out of the encoded folder.

    What I would like to do is have the script write a log and append to the log the files that are encoded. Then When the script starts I would like to check the log file for the filename to see if it was already encoded in the log. I have no problem writing the log file... Just cannot figure out how to check for existing files in the log.

    See Script below.

    do
    Script.sleep(300 * 1000)
    on error resume next

    dim filesys
    dim SageFolder
    dim SagePath
    Dim comskipbat
    dim encodefolder
    dim STARTWMV
    EncodePath="F:\EncodeWMV\"
    Encodesage="C:\testencodesage1.bat"
    SageFolder="D:\Sage1\"
    STARTWMV="C:\teststartwmvSage1.bat"

    Set filesys = CreateObject("Scripting.FileSystemObject")
    filesys.DeleteFile Encodesage
    filesys.CreateTextFile Encodesage, True
    Const ForReading = 1, ForWriting = 2, ForAppending = 8
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile(encodesage, ForAppending,TristateFalse)
    f.Write "IF EXIST C:\chksage.txt goto :end"
    F.Write VbCrLf
    f.Write "date /t >>c:\chksage.txt"
    F.Write VbCrLf


    Dim fs, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFolder(SageFolder)

    For Each file In f.Files

    if right(file.name,3)="mpg" then
    INPUTFILENAME=file.name

    ENCODEWMV=replace(INPUTFILENAME,".mpg",".wmv")


    if (FSO.FileExists(EncodePath & ENCODEWMV)) then



    else
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile(encodesage, ForAppending,TristateFalse)
    f.Write "cd C:\Program Files\Windows Media Components\Encoder"
    F.Write VbCrLf
    f.Write "c:"
    F.Write VbCrLf
    f.Write "cscript.exe WMCmd.vbs -input " & file & " -output " & EncodePath & " -loadprofile tvshows.prx"
    F.Write VbCrLf
    f.Write "copy "& sagefolder & ENCODEMY & " " & EncodePath
    F.Write VbCrLf
    f.close

    end if
    end if


    Next

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile(Encodesage, ForAppending,TristateFalse)
    f.Write "del C:\chksage.txt"
    F.Write VbCrLf
    f.Write ":end"
    F.Write VbCrLf
    f.Write "exit"
    f.close

    Set filesys = CreateObject("Scripting.FileSystemObject")
    filesys.DeleteFile STARTWMV
    filesys.CreateTextFile STARTWMV, True
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile(STARTWMV, ForAppending,TristateFalse)
    f.Write "start /belownormal /min " & Encodesage
    F.Write VbCrLf
    f.close

    Set objShell = CreateObject("WScript.Shell")
    objShell.Run STARTWMV
    loop
    Quote Quote  
  2. Samplecode:
    Code:
    DoEncode=true
    set fs= CreateObject("scripting.filesystemobject")
    set logfile = fs.opentextfile("c:\temp\logfile.txt")
    Do While logfile.AtEndOfStream <> TRUE
        strCurrentLine = logfile.ReadLine
        test = Instr(1,strCurrentLine,INPUTFILENAME)
        If test > 0 Then
            DoEncode=false
        End If
    Loop
    logfile.close
    
    if DoEncode then ...
    Quote Quote  
  3. borax,

    Thanks that did the trick.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!