autohotkeyschedulewmvwmp

autohotkey script to schedule a wmv


I'm new to AutoHotkey and am looking for some bit of assistance getting started.

Where do I begin if I wish to write a script that will schedule the opening of a .wmv file in WMP in full-screen every half an hour?

I know I need to use autohokey's run command. Should I use Windows Task Scheduler, or would it be better to manage the timer with AutoHotkey?


Solution

  • Try this:

    VideoLengthInSeconds = 60
    RunVideoEveryXMinutes = 30
    TheVideoFile = C:\MyVideoFile.wmv
    Loop
    {
        Run, wmplayer.exe "%TheVideoFile%" ;run the video in wmp
        Sleep, 3000 ;wait 3 seconds
        SendInput, {F11} ;send F11 to make it fullscreen
        Sleep, % VideoLengthInSeconds*1000 ;wait while video is playing
        Send, {alt down}{F4}{alt up} ;close the wmp
        Sleep, % RunVideoEveryXMinutes*60*1000 ;wait after the video was played
    }
    
    ;Use Esc to exit the script
    Esc::
      ExitApp