Jump to content

Display 2 video files in on 2 different monitors in fullscreen


rick2912
 Share

Recommended Posts

Hi, I hoping that someone could help me.

I am new to autoit and scripting in general. What I require is a script that will open 2 video files on 2 different monitors in fullscreen and play simultaneously.

I began with a batch file which opens the 2 files and plays them on the same screen. I have set vlc to open files in fullscreen.

The batch file is as follows:

start /min "vlc.exe" "C:\Documents and Settings\demo\Desktop\video1.wmv"

start /min "vlc.exe" "C:\Documents and Settings\demo\Desktop\video2.wmv"

taskkill /IM "vlc.exe"

I need to be able to tell video 1 to display on monitor 1.

I have searched through the forums, and the closest script is the play-video-end.au3 which is awesome, as it allows you to select the monitor and open the file. However this uses GUI menus and I wanted it to be automatic. This would be for demo purposes.

I'm not sure if the winmove function applies here as the files will open in fullscreen, but again I could be wrong.

This is the script I have that is an edit from play-video-end.au3

What is does is open both files but only displays video for the first one, and has a vlc window that isn't playing anything for the 2nd video. I have taken the -f functionality out of the script for now so i can see the 2 windows playing.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=AutoItv11.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

$Mon = 1
ShellExecute(_SearchPath(),Chr(34)&"C:\Documents and Settings\demo\Desktop\Rick\video1.wmv"&Chr(34)&" --no-embedded-video "&Chr(34)&_Monitor($Mon)&Chr(34)&" --no-video-title-show")

Exit

$Mon = 2
ShellExecute(_SearchPath(),Chr(34)&"C:\Documents and Settings\demo\Desktop\Rick\video2.wmv"&Chr(34)&" --no-embedded-video "&Chr(34)&_Monitor($Mon)&Chr(34)&" --no-video-title-show")

Exit


Func _SearchPath()
    $PathExe = StringSplit(RegRead("HKEY_CLASSES_ROOT\Applications\vlc.exe\shell\Open\command",""),Chr(34))
    If $PathExe[0] < 2 Then
        MsgBox (0, "Error:", "vlc.exe is not installed in your PC, please (re-)install vlc: http://www.videolan.org/")
        Exit
    Else
        Return Chr(34)&$PathExe[2]&Chr(34)
    EndIf
EndFunc

Func _Monitor($flag=0)
    Local $i = 0, $Out, $MaxMon
    While 1
        $aDevice = _WinAPI_EnumDisplayDevices("", $i)
        If Not $aDevice[0] Or  Not StringRegExp ( $aDevice[1], "DISPLAY[12]" , 0 ) Then ExitLoop
        If BitAND($aDevice[3], 2) = 2 And BitAND($aDevice[3], 1) = 1 Then
            $MaxMon = "\\.\DISPLAY"&StringRight($aDevice[1],1)
            If $flag = 1 then
                $Out = $MaxMon
                ExitLoop
            EndIf
        ElseIf BitAND($aDevice[3], 1) = 1 Then
            $MaxMon= "\\.\DISPLAY"&StringRight($aDevice[1],1)
            If $flag = 2 then
                $Out = $MaxMon
            EndIf
        Else
            $Out = $MaxMon
        EndIf
        $i += 1
    WEnd
        If $flag = 0 Then $Out = $MaxMon
    Return
EndFunc

Hope I can get some help on this.

Thanks

Rick

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...