-1

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?

bgmCoder
  • 6,205
  • 8
  • 58
  • 105
AMDG
  • 269
  • 2
  • 9
  • 2
    This isn't even an actual question. – MCL Nov 02 '13 at 15:17
  • 1
    @BGM How do you know that the OP "knows [he] needs to use autohotkey's `run` command." Or that he wants to know if he should use task scheduler or not? Be careful about editing questions so much that you move away from the intent of the author. Sometimes it is better for a question to be closed so that they learn the correct way to ask a question and don't expect people like you to make heroic edits to their question to make it acceptable. – Gray Nov 07 '13 at 16:26
  • 1
    please my question original was and is: how to schedule a .wmv file running every half an hour, but not using Windows Task Scheduler but Autohotkey on a Windows 8 platform – AMDG Nov 07 '13 at 19:19
  • Sorry, I was guessing. I figured he would need to use the RUN command if he is going to launch any applications. Someone else accepted my edit. And, to the OP - I only added that by way of suggestion - the original question didn't offer any information that made it look like anything had been attempted. – bgmCoder Nov 07 '13 at 19:29

1 Answers1

2

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
Forivin
  • 14,780
  • 27
  • 106
  • 199
  • the lenght of my video is 35 seconds. Also if wmp is already playing is it possible to have this video to run and after it finishes to continue playing the previous one? – AMDG Nov 07 '13 at 19:40
  • the above script is running but I need to isolate it because I added at the beginning of my script file and after it runs it closes my ahk file. – AMDG Nov 07 '13 at 20:06
  • I don't think that there is any way to read the current playing time of your video. So I don't really see a way to continue your video at the point you stoped it.. but it might be worse to ask directly in the Autohotkey forum. ;) For your second problem: Just create a new script for that. or use SetTimer: http://www.autohotkey.com/docs/commands/SetTimer.htm – Forivin Nov 07 '13 at 20:22
  • The problem with this solution is that it needs to make sure that wmp is the active window when it does the `sendinput` - otherwise it will `sendinput` to whatever window happens to be active, such as Chrome, perhaps. Adding a couple of `WinActivate ` commands will help. – bgmCoder Nov 08 '13 at 01:39
  • 1
    For a clean solution you should definitely go with "ControlSend" or "PostMessage". You need to know the WinTitle for this though... You could even check if there is a COM object for the WMP documentated in the msdn. – Forivin Nov 08 '13 at 04:39