Sign in to follow this  
Followers 0
TaoHunter

Switching between program and videos

6 posts in this topic

I'm a total nobody when it comes to AutoIt but we had a request from a client and I would like to know if the following is possible

I've made a couple of instructional videos for them which they want to show on a screen in their cantine.

On that screen is a simple program running that shows departure times.

I would like to know if it's possible with AutoIt to switch between this program and an array of like 6 movieclips. Each clip starting as soon as the switch is done and switching back to the program once the video is done playing. Then switching again after a defined period of time starting the next clip. etc... And this in a endless loop.

Is this possible and preferrably how? :)

Thanks in advance for any help.

Share this post


Link to post
Share on other sites



Hi TaoHunter,

Welcome to the forum!

How do you play those videos?

Do you have a player that run from command line? Something like: playvideo.exe c:videosmovie1.mov

or something like that? If yes, that will be much easier.

If not, try to find one :P

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I do have VLC which I think is capable of starting videos from command line.

If so, would you happen to have a script which would do the trick I need?

Everything has to keep running fullscreen all the time.

Edited by TaoHunter

Share this post


Link to post
Share on other sites

I do have VLC which I think is capable of starting videos from command line.

If so, would you happen to have a script which would do the trick I need?

Everything has to keep running fullscreen all the time.

 

If you have a video player that support command line, it will be much easier and much more reliable than automating the GUI.

No, I dont have the script, but the logic should be easy:

1. Put the files list on the array (hardcoded) or a folder. If those files are on a folder, read the file lists through the folder and save them into array

2. Loop through the array and run the video player with some parameters you need.

You can start here:

http://www.autoitscript.com/wiki/Arrays

Read the help file about For...Next, Run command and _FileReadToArray

Try to write the script yourself. Post your code here when you encounter a difficulty and someone will help :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Got it working as I intended.

$Program = "Program window name" ;Name of the infoWindow
$Clippath = "D:\Cliplocation\" ;Path to the infoclips
$Programwait = 5000 ;Time the infoWindow should be displayed - This will become a lot longer
Local $arr[6] = ["Clip01.mp4", "Clip02.mp4", "Clip03.mp4", "Clip04.mp4", "Clip05.mp4", "Clip06.mp4"] ;Array with all the clips
Local $timer[6] = [47200, 41000, 42000, 50500, 46500, 54800] ;Array with the duration of the clips
$counter = 0

 While $counter <= 5
   WinActivate($Program,"") ;Focus to infowindow
   Sleep($Programwait)
   ShellExecute($Clippath & $arr[$counter])
   Sleep(5000) ;Timer to let the VLC filename disapear
   WinActivate($arr[$counter],"") ;Focus to next clip in the Array
   Sleep($timer[$counter]) ;ClipDuration
   $counter = $counter + 1
      if $counter >= 6 Then ;Reset loop to start over
         $counter = 0
      EndIf
WEnd

At the moment the first clip starts you put VLC in fullscreen and after that this will remain running for as long as you want.

Probably a few things that could have been done better but I'm pretty happy with it :)

Thanks for the pointers Michaelslamet!

Edited by TaoHunter

Share this post


Link to post
Share on other sites

Glad you get it done! :thumbsup:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0