Hello Thweiss,
Apparently, info@vlc-forum.de don't like my bad english!
I try with Dateianhänge, Hochladen.
On the path F:\Vlc-de, I have put for you:
- MosaicIcon.ico, an icon for Mosaic VLC;
- Mosaic Video.lnk, a shortcut for start Mosaic VLC;
- Mosaic.bat, the cmd script.
I have seen Erlaubte Dateiendungen; all the above files are renamed with .txt; for MosaicIcon.ico (.txt) and Mosaic.bat (.txt) -> refused!
I put Mosaic.bat in Quellcode; I don't see how return to message!
I wish a good send; do not hesitate to ask me for explanations.
Kind regards.
Edmund
@echo off
rem ##################################################################################
rem # Mosaic VLC -> from Video-1 to Video-4 #
rem # ------------------------------------- #
rem # All the windows are started with the audio. #
rem # #
rem # All the hotkeys of VLC are usable for each subpicture, after select with a #
rem # mouse click. #
rem # #
rem # After launching of each subpicture, True is displayed in Mosaic VLC to #
rem # indicate a good start, in mute; else, False is displayed. #
rem # #
rem # To quit the mosaic, select Mosaic VLC and strike any key. #
rem # #
rem # WARNING: #
rem # Here, it is assumed that the creation time of the task corresponding to a #
rem # sub-window is less than one second; if he can be superior: #
rem # - increase the time in AudioToggle, $_.CPU -le 1; #
rem # - if he is random, add a loop to make sure the task is fully started #
rem # before searching for his Process id. #
rem # #
rem # Technical informations: #
rem # - a VLC subpicture is composed of two windows Windows 10: #
rem # - one main, hidden, identified by his Process id and his hWnd; #
rem # - one child, used for display, identified by his hWnd; #
rem # - the hotkeys of VLC must be adressed to the child window; #
rem # - after sending to a child window, the only direct method to retrieve the #
rem # focus here, is the use of Task view by the send of Alt+Tab; #
rem # - NULL is a file created in the current path to log debug informations. #
rem # #
rem # Malfunctions: #
rem # - thin black border around the videos; unknown cause; #
rem # - --width and --height don't function; BUG VLC; here, --zoom is used; #
rem # the inconvenients are : #
rem # - necessity to adjust --zoom to obtain the wished size of the subpicture; #
rem # - loss of video quality in fullscreen (strike of F), because upscaling on a #
rem # reduced video resolution cannot be well displayed in the subpicture. #
rem # #
rem ##################################################################################
rem ##################################################################################
rem # Global variables initialization. #
rem # #
rem ##################################################################################
setlocal enabledelayedexpansion &rem necessary for array and for /f loop
set "title=Mosaic VLC"
set "Stars=********************" &rem for well identify results of debug
set "DllFwe='[DllImport("""user32.dll""")] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, IntPtr lclassName, string windowTitle);'"
set "DllSfw='[DllImport("""user32.dll""")] public static extern bool SetForegroundWindow(IntPtr hWnd);'"
set ProcessId=0 & set hWmain=0 & set hWchild=0 &rem Initialization of the variables for returned values
set SubpictureOldInd=0
title %title%
echo %title% started >NULL &rem debug
rem New session (required for good use of SetForegroundWindow);
powershell -Command " & {(New-Object -ComObject Shell.Application).MinimizeAll()}" &rem Minimize all opened windows (likewise with WinKey+M)
rem ##################################################################################
rem # Launching of the four subpictures. #
rem # #
rem ##################################################################################
set "PathVlc=C:\Program Files (x86)\VideoLAN\VLC\"
set "PathVideo=F:\Vlc-de\"
set "Opt-0=--no-one-instance --no-one-instance-when-started-from-file --loop --no-repeat --no-embedded-video"
set "Opt-1=--swscale-mode=10 --qt-start-minimized --no-qt-video-autoresize --no-video-deco --no-video-title-show"
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=1 --zoom=0.75 "%PathVideo%Video-1.mp4"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=1 --zoom=0.75 "%PathVideo%Video-2.mp4"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=1 --video-y=541 --zoom=0.75 "%PathVideo%Video-3.mp4"
call :AudioToggle
start "" "%PathVlc%vlc.exe" %Opt-0% %Opt-1% --video-x=961 --video-y=541 --zoom=0.75 "%PathVideo%Video-4.mp4"
call :AudioToggle
rem Informations given in the cmd window (Mosaic VLC).
echo ^ Select a subpicture, strike:
echo ^ ^ m to toggle audio mode
echo ^ ^ f to toggle fullscreen mode
echo ^ ^ n -^> next video
echo ^ ^ p -^> previous video
echo ^ ^ ~
echo ^ To quit, select Mosaic VLC
echo ^ and strike any key.
pause >>NULL
rem Select cmd and strike any key to quit all instances of VLC.
powershell $WS=New-Object -ComObject wscript.shell; While($WS.AppActivate('VLC (Direct3D output)')){Sleep 1; $WS.SendKeys([char]94+'q')}
exit
rem ##################################################################################
rem # FUNCTION AudioToggle -> to toggle the sound, using the hotkey M of VLC, for #
rem # ----------- one subpicture. #
rem # #
rem # Warnings: #
rem # - %, ", are significant characters for the command interpreter; for direct use,#
rem # they must be trebled; #
rem # - caret ^ is used at the end of a multiple lines command; its function is to #
rem # take the next character for his ASCII value, here New line; so, the caret #
rem # must be the last character of the line, and it's necessary to use Notepad or #
rem # equivalent to edit; #
rem # - to transmit online several return values from a PowerShell script to the #
rem # calling cmd, the only possible method is the using of Environment Variable; #
rem # the method used here ensures the good affectation in a cmd set statement. #
rem # #
rem ##################################################################################
:AudioToggle
set /a SubpictureOldInd+=1 &rem Increment the value of the variable by 1
set ProcessId=0 & set hWmain=0 & set hWchild=0 &rem Initialization of the variables for returned values
rem Line by line:
rem - get the Process id of the last subpicture started;
rem - waiting for the subpicture construction, and get the handle number of the MAIN window ($hWm);
rem - get the handle number of the CHILD window ($hWc);
rem - update the return value in the Environment Variable Vlc;
rem - set the focus to the CHILD window;
rem - the Sleep below is, only, to obtain a delay for listening the audio;
rem send the hotkey m to toggle audio, and retrieve immediately the focus for cmd.
powerShell $Pi=Get-Process 'vlc' ^| Where-Object{$_.CPU -le 1} ^| Select -expand ID; ^
Sleep 1; $hWm=(Get-Process -Id $Pi.ToString()).MainWindowHandle; ^
$FW=Add-Type -MemberDefinition %DllFwe% -Name Wfw -PassThru; $hWc=$FW::FindWindowEx($hWm,[IntPtr]::Zero,[IntPtr]::Zero,[String]::Empty); ^
[System.Environment]::SetEnvironmentVariable('Vlc', $Pi.ToString()+' '+$hWm.ToString()+' '+$hWc.ToString(), 'user'); ^
$SF=Add-Type -MemberDefinition %DllSfw% -Name Wsf -PassThru; $SF::SetForegroundWindow($hWc); ^
$WS=New-Object -ComObject wscript.shell; Sleep 4; $WS.SendKeys('m'); $WS.SendKeys('%%%{TAB}')
rem Get return value in Vlc; this syntax reg query is for a one line result of a command.
for /f "tokens=3-5" %%V in ('"reg query "HKCU\Environment" /v Vlc"') do (set ProcessId=%%V &set hWmain=%%W &set hWchild=%%X)
rem These variables are for future developments.
echo %Stars% Subpicture %SubpictureOldInd% ProcessId= %ProcessId% hWmain= %hWmain% hWchild= %hWchild% %Stars% >>NULL &rem debug
goto:eof
rem # End of the FUNCTION AudioToggle ################################################