Here is a plugin for the Winamp control. There are several versions of this now apparently, I think I found the right one, listed in the plugin's help text. I am not 100% sure it is the right one though. I am also not sure if the plugin itself will work 100% right, since I had to hack the bits for it out of the main script file (it was tied in with a mess of other things displayed on the info bar). If you have a plugin already using that, then this will need several changes.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, July 08, 2005, 10:02 PM -->
<!-- MuClient version 3.66 -->
<!-- Plugin "Winamp_Plugin" generated by Plugin Wizard -->
<muclient>
<plugin
name="Winamp_Plugin"
author="kagehi"
id="e63914767b5cd4d44254047c"
language="VBscript"
purpose="Example of using Winamp with Mushclient."
save_state="y"
date_written="2005-07-08 21:52:54"
requires="2.00"
version="1.0"
>
<description trim="y">
<![CDATA[
This uses a winamp plugin to connect to Winamp and provide basic
controls from inside Mushclient. Note: There are occational
problems, caused by the fact that you are forced to call the
Winamp plugin, but it is not closed properly in some cases, like
when closing Winamp, 'then' closing Mushclient. Sometimes closing
them in the wrong order causes Mushclient to crash when closing.
This isn't fixable as near as I can tell.
This is also an untested plugin, since the original code was not
in a seperate plugin and needed to intergrate the output with other
things in the info bar. Adjustments may be needed.
This uses the Winamp plugin here (I think):
http://www.winamp.com/plugins/details.php?id=6538
A better one now exists with more features, called "ActiveWinamp",
but using it will require extensive changes to this plugin and
the automatic functions (i.e. events) will still not be usable as
they would be in a browser or application. This is due to how the
object is created. When created as with this plugin, the object is
tied to the script for commands, like winamp.play, but there is
nothing 'listening' for events from winamp, so it has no way to
know when such a thing has been sent or what script to call for
it. The 'Song' function is an example of one not available due to
this. In other words, you can 'command' winamp from here, but this
plugin can't be commanded by or told anything by winamp, except
when specifically requested. This is why the CalcTime timer
periodically asks Winamp the song name, to see if it has changed.
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
name="Close_Winamp"
match="WinampKill"
group="WinAmp"
send_to="12"
menu="y"
sequence="101"
>
<send>winamp.stop
winamp=""
enablealias "Open_Winamp",1
enablegroup "WinAmp",0</send>
</alias>
<alias
name="Next_Track"
match="Next Track"
group="WinAmp"
send_to="12"
menu="y"
sequence="103"
>
<send>winamp.fastforward</send>
</alias>
<alias
name="Toggle_Repeat"
match="ToggleRepeat"
group="WinAmp"
send_to="12"
menu="y"
sequence="107"
>
<send>if winamp.RepeatStatus then
note "Winamp: Repeat Off"
winamp.RepeatStatus = vbFalse
else
note "Winamp: Repeat On"
winamp.RepeatStatus = vbTrue
end if</send>
</alias>
<alias
name="Open_Winamp"
script="Open_Winamp"
match="OpenWinamp"
enabled="y"
menu="y"
sequence="100"
>
</alias>
<alias
name="Pause_Winamp"
match="PauseSong"
group="WinAmp"
send_to="12"
menu="y"
sequence="106"
>
<send>winamp.pause</send>
</alias>
<alias
name="Previous_Track"
match="Previous Track"
group="WinAmp"
send_to="12"
menu="y"
sequence="102"
>
<send>winamp.rewind</send>
</alias>
<alias
name="Play"
match="WMPlay"
group="WinAmp"
send_to="12"
menu="y"
sequence="104"
>
<send>winamp.play</send>
</alias>
<alias
name="Toggle_Shuffle"
match="ToggleShuffle"
group="WinAmp"
send_to="12"
menu="y"
sequence="107"
>
<send>if winamp.ShuffleStatus then
note "Winamp: Shuffle Off"
winamp.ShuffleStatus = vbFalse
else
note "Winamp: Shuffle On"
winamp.ShuffleStatus = vbTrue
end if</send>
</alias>
<alias
name="Stop"
match="WMStop"
group="WinAmp"
send_to="12"
menu="y"
sequence="105"
>
<send>winamp.stop</send>
</alias>
</aliases>
<!-- Timers -->
<timers>
<timer name="CalcTime" script="CalcTime" enabled="y" second="5.00" >
</timer>
<timer name="Volume_Adjust" script="AdjVolume" enabled="y" second="1.00" active_closed="y" >
</timer>
</timers>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="Winamp_Plugin:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
dim winamp
enablealias "Open_Winamp",1
enablegroup "WinAmp",0
'dim WindowObject
'set WindowObject = createobject("MUClientWindow.TextBox")
'WindowObject.Topmost = True
'WindowObject.SetTitle "Channel Window"
'WindowObject.SetPosition 11830, 0, 7190, 12000'300, 500, 12000, 3000
'WindowObject.Locked = True
'WindowObject.BackgroundColor = vbBlack
Sub OnHelp (sName, sLine, wildcards)
world.Note world.GetPluginInfo (world.GetPluginID, 3)
End Sub
sub Open_Winamp (name, output, wilds)
set winamp=createobject("WinampCOM.application")
if winamp.PlayListCount < 1 then
winamp.AddFile("C:\My Documents\My Music\Playlists\Favorites.m3u")
winamp.play
winamp.fastforward
end if
enablealias "Open_Winamp",0
enablegroup "WinAmp",1
'Set winamp.SongChange = GetRef("song")
end sub
'sub song(song) 'Not usable, since there is no way to connect the 'event' to the function.
' note song
'end sub
sub OnPluginClose
set winamp = Nothing
end sub
sub CalcTime(Name)
if typename(winamp) = "IApplication" then
world.infoclear
world.InfoFont "Calisto MT",8,1
world.infocolour "midnightblue"
world.info "Winamp: "
world.InfoFont "Lucida Handwriting",6,1
world.InfoColour "black"
world.info getvariable("CSong")
end if
end sub
sub AdjVolume (name) 'This was added to deal with songs that where not the same volume.
'By adjusting up or down, they would all sound the same, even when not.
dim Slist(10)
Slist(0) = "Princess Mononoke"
Slist(1) = "Loved By The Sun"
Slist(2) = "My Will (English"
Slist(3) = "Nuovo interprete"
Slist(4) = "Alchemy of Love"
if typename(winamp) = "IApplication" then
temp = winamp.CurrentSongTitle
'note temp & " " & getvariable("CSong")
if temp <> getvariable("CSong") then
setvariable "CSong",temp
fnd = 0
for count = 0 to 4
if instr (temp,Slist(count)) then
fnd = 1
exit for
end if
next
if fnd then
winamp.SetVolume(255)
else
winamp.SetVolume(179) ' 70%
end if
end if
end if
end sub
]]>
</script>
</muclient>
But heh, its better than nothing. ;) If you used Python or Lua instead to make on for the new ActiveWinamp (or even remake this one), those 'do' provide a way to accept events from Winamp, which is the fatal flaw that VBScript, JScript and others have and why I had to use 'CurrentSongTitle' to retrieve the name every 30 seconds, instead of just letting Winamp tell Mushclient when the song changed and checking the name once after. :( |