Log in

View Full Version : Play video in VBScript


ariga
20th July 2008, 11:18
I'm learning WSH scripting. I found a script that plays audio and tried the same to playback a video. Here's the script

Set oMplayer = WScript.CreateObject("WMPlayer.OCX")
oMPlayer.url = "I:\DVCapture\video.avi"
oMPlayer.Controls.Play
Wscript.Sleep 10000
oMplayer.Controls.stop


With this only the audio plays fine. The video is not visible.
Is there something missing here? Any alternative method to play back video?

LoRd_MuldeR
20th July 2008, 17:18
Calling MPlayer from a VBScript should be possible, I guess...

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """c:\mplayer.exe"" ""I:\DVCapture\video.avi"""

ariga
20th July 2008, 18:19
Thanks, that works.

I found this works too
oMplayer.openPlayer("I:\DVCapture\video.avi")
But there is no way to control the playback after that.:confused:

LoRd_MuldeR
20th July 2008, 18:24
MPlayer front-ends send commands to MPlayer in Slave mode via Stdin. No idea how to do that with VBScript...

SLAVE MODE PROTOCOL
-------------------

The -slave option switches on slave mode, in which MPlayer works as a backend
for other programs. Instead of intercepting keyboard events, MPlayer will read
commands separated by a newline (\n) from stdin.

The documentation on that feature is here: http://www.mplayerhq.hu/DOCS/tech/slave.txt