vbscript opens mp4 in wmplayer, but only audio plays

1

I'm trying to simply open a video in full screen using a batch file, I realised this wasn't possible so I included code to make it write to vbscript instead and then later on execute the vbscript code.

I'm running windows 10, and I have another script running an mp3 file that works fine.

This is what my batch file is writing to the vbscript

set "file2=res\FORTNITESKINS.mp4"
( echo Set wmp = CreateObject("WMPlayer.OCX"^)
  echo Video.URL = "%file2%"
  echo Video.Controls.play
  echo do while Video.currentmedia.duration = 0
  echo wscript.sleep 100
  echo loop
  echo wscript.sleep (int(Video.currentmedia.duration^)+1^)*1000
  echo set WshShell = WScript.CreateObject("WScript.Shell"^)
  echo WScript.Sleep 1000
  echo WshShell.SendKeys "%{ENTER}") >video.vbs

This is how I execute the vbscript

start video.vbs

The video does not open, only the audio plays, and wmplayer doesn't even open minimized, nor can I find it in task manager.

I have also tried this,

set "file2=res\FORTNITESKINS.mp4"
( echo Set Video = CreateObject("WMPlayer.OCX"^)
  echo Video.openPlayer("%file2%"^)
  echo set WshShell = WScript.CreateObject("WScript.Shell"^)
  echo WScript.Sleep 1000
  echo WshShell.SendKeys "%{ENTER}") >video.vbs

but it gives the error:

Line: 2
Char: 1
Error: 0xC00D1329
Code: C00D1329
Source: (null)
batch-file
vbscript
wmplayer
asked on Stack Overflow Apr 15, 2019 by Alfie Atkinson • edited Apr 15, 2019 by Alfie Atkinson

2 Answers

2

Why don't you use wmplayer directly with proper command-line-parameters ?

@Echo off
set "file2=res\FORTNITESKINS.mp4"
set wmplayer="%ProgramFiles(x86)%\Windows Media Player\wmplayer.exe" /prefetch:1

%wmplayer% "%file2%" /fullscreen
answered on Stack Overflow Apr 15, 2019 by (unknown user)
0

You can do it like this example :

@echo off
Mode 70,3 & color 0B
echo(
Set "Title=Playing videos with Windows Media Player"
Title %Title%
echo              %Title%
Set "URL-FILE=http://1290922571.rsc.cdn77.org/movies/Superman-Unbound-2013-FRENCH.mp4/playlist.m3u8"
Start "%Title%" wmplayer /fullscreen "%URL-FILE%"
Timeout /T 2 /NoBreak>nul

EDIT :

@echo off
Mode 70,3 & color 0B
echo(
Set "Title=Playing videos with Windows Media Player"
Title %Title%
echo              %Title%
Set vbs_video=%temp%\vbs_video.vbs
Set video=http://1290922571.rsc.cdn77.org/movies/Superman-Unbound-2013-FRENCH.mp4/playlist.m3u8
Call :Play %video%
Timeout /T 2 /NoBreak>nul & Exit
REM ***************************************
:Play <video>
(
    echo Set Video = CreateObject("WMPlayer.OCX"^)
    echo Video.openPlayer("%~1"^)
    echo set WshShell = CreateObject("WScript.Shell"^)
    echo WScript.Sleep 3000
    echo WshShell.SendKeys "%%{ENTER}"
)>"%vbs_video%"
Start "video" "%vbs_video%"
exit /b
REM ***************************************
answered on Stack Overflow Apr 15, 2019 by Hackoo • edited Apr 16, 2019 by Hackoo

User contributions licensed under CC BY-SA 3.0