VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. I wrote a VBScript to monitor my Video Capture folder put the date and time at the begining and move it to another folder. What I need is to run the Script every 60 seconds. My Script is below. I want to use this in conjunction with ProCoder folder watch.

    ---Start Script------
    dim oldname
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFolder("d:\video")
    For Each file In f.Files
    if right(file,3)="avi" then
    oldname=file.name
    dim fname
    Dim sSourceFile
    Dim sDestinationFile

    TheDay = Weekday(now)
    TheYear = year(now)
    TheMon = month(now)
    TheHour= hour(now)
    TheMinute=minute(now)
    theSecond=second(now)

    fname = Themon & "-" & TheDay & "-" & TheYear & "-" & "T" & thehour & theminute & thesecond & "-" & oldname
    file.name = fname

    sSourceFile = "d:\video\" & fname
    sDestinationFile = "d:\ENCODE\xvcd\" & fname
    FSO.MoveFile sSourceFile, sDestinationFile

    end if
    Next

    ---End Script------
    Quote Quote  
  2. VH Veteran jimmalenko's Avatar
    Join Date
    Aug 2003
    Location
    Down under
    Search PM
    Windows scheduled tasks can do it for you every minute.

    Set it up to run (once) daily:


    Then use the Advanced button to set it to repeat every minute for 24 hours:


    This then adjusts it so that it runs every 1 minute for 24 hours every day (of the week) and it's reflected here:


    Job's right
    If in doubt, Google it.
    Quote Quote  
  3. VH Veteran jimmalenko's Avatar
    Join Date
    Aug 2003
    Location
    Down under
    Search PM
    Solution above. I must say that it's a pretty cool idea. Mind if I "borrow" that VBS script ?
    If in doubt, Google it.
    Quote Quote  
  4. jimmalenko,

    Don't mine at all. I know there is a way to make it recursive... For Now I will use the scheduler.


    BTW Thanks the scheduler will do for now.
    Quote Quote  
  5. Member tekkieman's Avatar
    Join Date
    Mar 2004
    Location
    Over the hill
    Search Comp PM
    What is the wrapper going to be for this script? The ways I can think of to do this is a) write a windows service that runs as either manual or automatic, and runs the script based on a timer event, or b) either an executable or web page wrapper that contains an Active X timer object and calls the script on the timer interval event.

    If either of those sound reasonable, let me know and I can help.
    Quote Quote  
  6. tekkieman

    My Intention was to simply double click the Script and have it run.... but I like your Idea to run as a system service. I can create an executable in visual basic...but I really didn't want to go that route. The Scheduler works fine. I want to keep it simple.
    If a System Service is do-able let me know thx.
    Quote Quote  
  7. Member tekkieman's Avatar
    Join Date
    Mar 2004
    Location
    Over the hill
    Search Comp PM
    You should still be able to create a reference to a timer object:

    Code:
    <OBJECT
    classid="clsid:59CCB4A0-727D-11CF-AC36-00AA00A47DD2"
    id=timer1
    
    <param name="Interval" value="60000">
    <param name="enabled" value="-1">
    </OBJECT>
    
    
    sub timer1_timer
           'call your script.
    end sub
    Quote Quote  
  8. Member tekkieman's Avatar
    Join Date
    Mar 2004
    Location
    Over the hill
    Search Comp PM
    Ok, forget all that! Let's keep it real simple. Here is your code with one line added.

    Code:
    dim oldname 
    
    do
      WScript.sleep(60 * 1000)
      Set fso = CreateObject("Scripting.FileSystemObject") 
      Set f = fso.GetFolder("d:\video") 
      For Each file In f.Files 
        if right(file,3)="avi" then 
          oldname=file.name 
          dim fname 
          Dim sSourceFile 
          Dim sDestinationFile 
    
          TheDay = Weekday(now) 
          TheYear = year(now) 
          TheMon = month(now) 
          TheHour= hour(now) 
          TheMinute=minute(now) 
          theSecond=second(now) 
    
          fname = Themon & "-" & TheDay & "-" & TheYear & "-" & "T" & thehour & theminute & thesecond & "-" & oldname 
          file.name = fname 
    
          sSourceFile = "d:\video\" & fname 
          sDestinationFile = "d:\ENCODE\xvcd\" & fname 
          FSO.MoveFile sSourceFile, sDestinationFile 
    
        end if 
      Next
    loop
    Ok, technically, it's 3 lines since I added the loop, but I've tested the WScript.sleep(60 * 1000) method under XP Pro SP2, and it works fine. Of course, you'll have to kill the process from task manager, but what do you want for nothing?
    Quote Quote  
  9. tekkieman

    That works Great.

    Thanx
    Quote Quote  
  10. Member tekkieman's Avatar
    Join Date
    Mar 2004
    Location
    Over the hill
    Search Comp PM
    No prob.
    Quote Quote  



Similar Threads

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