[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Using Media Player from a script (sort of).

Using Media Player from a script (sort of).

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Shadowfyr   USA  (1,787 posts)  [Biography] bio
Date Wed 18 Jan 2006 10:32 PM (UTC)
Message
This bit of script, in VBScript, *almost* works. I say almost, since for some incomprehensible reason it insists any file you open this way is an unrecognized format:

dim wmp
Open_WMP(name, output, wildcards)
  set wmp = createobject("WMPlayer.OCX")
  '"blah" should be replaced with the correct directory,
  'while the trigger/alias passes the name to this function,
  'such as My Song.mp3.
  wmp.openplayer("blah" + wildcards(1)) 
  wmp.controls.play
end

Close_WMP(name, output, wildcards)
  wmp.close 'NOTE: Close the application or the file?
            'I assume the later, since it certainly doesn't
            'close the player.
  set wmp = nothing 'Kill the OCX object, so it stops taking
                    'up memory.
end


Needless to say, this doesn't *quite* work. It may be possible with a playlist or existing media file to use other commands from here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay10/mmp_sdk/controlreference.asp

To pick one and play it from the playlist/media list. I haven't tried that though. Giving it the exact path and name however *always* seems to produce a, "Media Player cannot recognize the file type...." error, then a "Can't find the file" type error, even though checking the file properties in the player shows the correct name, path, etc.

I figured this could give people a starting point for a real way to link up WMP with Mushclient, even though it doesn't actually work right at this point. And maybe someone else can figure out how the heck to fix it. ;) lol
[Go to top] top

Posted by Shadowfyr   USA  (1,787 posts)  [Biography] bio
Date Reply #1 on Sat 21 Jan 2006 11:40 PM (UTC)
Message
Found the problem.. Seems Windows Media Player requires you to double the "\", for example:

wmp.openplayer("c:\\My Music\\Music Temp\\Panic Attack.mp3")

Odd thing being that it sets the correct info, even if you don't use \\, but it just won't play the damn things. lol Now if there was just a way to minimize the player or close it through the interface...
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,274 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]