Discussion:
have vbscript open media player in a top left window without border
(too old to reply)
r***@gmail.com
2015-07-22 08:58:56 UTC
Permalink
Hi All,

I`m trying to get VBSCRIPT to lauch media player (a movie) with the following options:

1. run media player;
2. run it in the top left screen (resolutions 320 *180)
3. run it without border.

Do you guys know if this is possible with VBSCRIPT?

Thanks
Rob.
Evertjan.
2015-07-22 09:52:09 UTC
Permalink
Post by r***@gmail.com
1. run media player;
2. run it in the top left screen (resolutions 320 *180)
3. run it without border.
Do you guys know if this is possible with VBSCRIPT?
VBscript is a scripting language,
so needs an interpreter programme to interprete and run it.

Then it depends on the platform:
browser, wscript/cscript, asp, etc.
and operating system where this programme is to be running:
windows, windows server, linux, mac, ios, android, etc.

Having a computer, a screen
and being able to run your "media player",
which is not a movie but a programme btw,
seems a prerequisite.

So surely in some combination it might be prossible,
perhaps it is better first to name the intended platform and os.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mayayana
2015-07-22 12:28:20 UTC
Permalink
This post might be inappropriate. Click to display it.
Dave "Crash" Dummy
2015-07-22 22:17:10 UTC
Permalink
Post by Mayayana
I've never used WMP but I think the object
your want is WMPlayer.ocx. The type library
is in wmp.dll. With a type library reader you
can look up your options. (You may not understand
that. If not then you probably need to do some
research.)
As I understand it, the "object" is an ActiveX
control. It doesn't run as a program. You can
put it on a webpage, maybe in an HTA, which
you can then control to some extent. But ActiveX
controls don't run independently. So maybe you
could create an HTA with a WMP in it. To automate
that you'd need another script to launch it. Your
position/resize options would be with the HTA, not
WMP.
In short, you're asking about details in what
would probably be a complex set of scripts and
IE/HTA automations. You might be better off to
just look online for options to play video on the
Desktop.
I have never used this and don't pretend to understand it, but this
snippet is in my notes:

<quote>
<OBJECT ID="MediaPlayer" Name="MediaPlayer"
style="LEFT: 0px; TOP: 0px; width: 400px; HEIGHT: 300px;
background-repeat: no-repeat;"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject"

codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
VIEWASTEXT>

<PARAM NAME="AutoStart" VALUE="false">
<PARAM NAME="enableContextMenu" VALUE="true">
<PARAM NAME="ShowControls" VALUE="true">
<PARAM NAME="AnimationAtStart" VALUE="false">
<PARAM NAME="TransparentAtStart" VALUE="false">
<PARAM NAME="ShowStatusbar" VALUE="true">
<PARAM NAME="AllowChangeDisplaySize" VALUE="true">
<PARAM NAME="AutoSize" VALUE="false">
<PARAM NAME="URL" VALUE="Good Time Charlie's Got The Blues.mp3">

<EMBED
type="application/x-oleobject"

pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"

name="MediaPlayer"
autostart="false"
enablecontextMenu="true"
showcontrols="true"
animationatstart="false"
transparentatstart="false"
ShowStatusbar="true"
AllowChangeDisplaySize="true"
AutoSize="false"
DisplaySize=""
enableContextMenu="0"
src="Good Time Charlie's Got The Blues.mp3"
width=400
height=300 >

</OBJECT>

</quote>
--
Crash

Life is short. Eat dessert first.
Mayayana
2015-07-23 02:25:39 UTC
Permalink
Your code works. I have an mp3 on my Desktop
and can load it with the following HTA:

'------------ begin hta----------------------

<HTML>
<HEAD>
<HTA:APPLICATION ID="Player">

<TITLE></TITLE>
<SCRIPT LANGUAGE="VBScript">
Sub window_onload()
Dim HTAPath, sCommand
Dim s, Pt1, iQ, i2, Q2
window.resizeto 400, 300
window.moveto 0, 0

s = Player.commandLine
Q2 = Chr(34)
iQ = 0
For i2 = 1 to Len(s)
Select Case Mid(s, i2, 1)
Case " "
If iQ Mod 2 = 0 Then
HTAPath = Left(s, i2 - 1)
HTAPath = Trim(Replace(HTAPath, Q2, ""))
If Len(s) > i2 Then
sCommand = Right(s, Len(s) - i2)
sCommand = Trim(Replace(sCommand, Q2, ""))
End If
Exit For
End If
Case Q2
iQ = iQ + 1
Case Else
'-
End Select
Next

MediaPlayer.URL = sCommand
End Sub

</SCRIPT>

</HEAD>
<BODY>
<OBJECT ID="MediaPlayer" Name="MediaPlayer"
style="margin: 0px; margin: 0px; position:absolute; LEFT: 0px; TOP: 0px;
width: 370px; HEIGHT: 270px;"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
<PARAM NAME="AutoStart" VALUE="false">
<PARAM NAME="enableContextMenu" VALUE="true">
<PARAM NAME="ShowControls" VALUE="true">
<PARAM NAME="AnimationAtStart" VALUE="false">
<PARAM NAME="TransparentAtStart" VALUE="false">
<PARAM NAME="ShowStatusbar" VALUE="true">
<PARAM NAME="AllowChangeDisplaySize" VALUE="true">
<PARAM NAME="AutoSize" VALUE="false">
</OBJECT>
</BODY></HTML>
'-------------------------- end hta -----------------

I can call it with the following VBScript:

'------------begin script----------------------
Set SH = CreateObject("WScript.Shell")
sh.Run "C:\windows\desktop\player.hta " & "C:\windows\desktop\wilsons
snipe.mp3"
Set sh = Nothing
'-------end script----------------------------

It's a bit clunky because the command line
for an HTA is a mess, but it works. It still
has a basic window frame, but I was able,
with someexperimenting, to get a pretty good
fit of WMP into the window.
Dave "Crash" Dummy
2015-07-23 21:37:00 UTC
Permalink
Post by Mayayana
Your code works. I have an mp3 on my Desktop
'------------ begin hta----------------------
<HTML>
<HEAD>
<HTA:APPLICATION ID="Player">
<TITLE></TITLE>
<SCRIPT LANGUAGE="VBScript">
Sub window_onload()
Dim HTAPath, sCommand
Dim s, Pt1, iQ, i2, Q2
window.resizeto 400, 300
window.moveto 0, 0
s = Player.commandLine
Q2 = Chr(34)
iQ = 0
For i2 = 1 to Len(s)
Select Case Mid(s, i2, 1)
Case " "
If iQ Mod 2 = 0 Then
HTAPath = Left(s, i2 - 1)
HTAPath = Trim(Replace(HTAPath, Q2, ""))
If Len(s) > i2 Then
sCommand = Right(s, Len(s) - i2)
sCommand = Trim(Replace(sCommand, Q2, ""))
End If
Exit For
End If
Case Q2
iQ = iQ + 1
Case Else
'-
End Select
Next
MediaPlayer.URL = sCommand
End Sub
</SCRIPT>
</HEAD>
<BODY>
<OBJECT ID="MediaPlayer" Name="MediaPlayer"
style="margin: 0px; margin: 0px; position:absolute; LEFT: 0px; TOP: 0px;
width: 370px; HEIGHT: 270px;"
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
<PARAM NAME="AutoStart" VALUE="false">
<PARAM NAME="enableContextMenu" VALUE="true">
<PARAM NAME="ShowControls" VALUE="true">
<PARAM NAME="AnimationAtStart" VALUE="false">
<PARAM NAME="TransparentAtStart" VALUE="false">
<PARAM NAME="ShowStatusbar" VALUE="true">
<PARAM NAME="AllowChangeDisplaySize" VALUE="true">
<PARAM NAME="AutoSize" VALUE="false">
</OBJECT>
</BODY></HTML>
'-------------------------- end hta -----------------
'------------begin script----------------------
Set SH = CreateObject("WScript.Shell")
sh.Run "C:\windows\desktop\player.hta " & "C:\windows\desktop\wilsons
snipe.mp3"
Set sh = Nothing
'-------end script----------------------------
It's a bit clunky because the command line
for an HTA is a mess, but it works. It still
has a basic window frame, but I was able,
with someexperimenting, to get a pretty good
fit of WMP into the window.
You can get rid of the borders and caption bar in HTA windows
by choosing the appropriate options:

<HTA:application caption="no" border="none" innerborder="no">

See
https://msdn.microsoft.com/en-us/library/ms536471(v=vs.85).aspx
--
Crash

All this time I thought my analyst was saying I'm psychic...
Loading...