Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, 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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Running Winamp from a script?
|
Running Winamp from a script?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Sleeve
(31 posts) Bio
|
| Date
| Fri 13 Jun 2003 09:52 PM (UTC) |
| Message
| | Is it possible to run Winamp from a script? It's really just for convenience sake, since my script will work if I run Winamp manually... but I would like to automate that if I could. | | Top |
|
| Posted by
| Poromenos
Greece (1,037 posts) Bio
|
| Date
| Reply #1 on Sat 14 Jun 2003 12:48 AM (UTC) |
| Message
| You have a script to control winamp through DDE? Could you post a few samples or all of it? It would be very interesting.
I don't think you can run it from a script though, I haven't been able to figure out how to run files. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #2 on Sat 14 Jun 2003 07:08 PM (UTC) |
| Message
| Hmm.. Using COM to talk too Winamp is a problem. There are usable controls for Real Player, Windows Media Player and Quicktime, but looking through the list available to Visual Basic, I can't see anything for Winamp. Odds are it therefore does not provide a method of talking to it through COM. :p You would have to use some other method to run it.
One option seems to be to create a Windows Scripting object and have that object do a Run command on the program. I haven't the slightest clue how that works though, so you will have to hunt around for someone that does. | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #3 on Sat 14 Jun 2003 08:05 PM (UTC) Amended on Sat 14 Jun 2003 08:07 PM (UTC) by Shadowfyr
|
| Message
| Hmm. After a bit of searching.. The Winamp COM DLL from http://mysite.freeserve.com/johnadcock looks promising. It is the top link (gen_com.zip). However, this just provides the object and some docs on how to get it installed and available. Using it will likely require looking at something like www.sloppycode.net/sloppycode/Delphi/cm11.html (this has a full list of Winamp 2 API functions) or the Winamp site itself to get the actually API commands. If you are using Winamp 3, then I am not sure they have the extended API list available yet and I would bet that this DLL doesn't support them anyway. However, the existing API 'should' still be compatible with what it does provide.
However, assuming this will work right then you should be able to do something like:
Winamp = createobject("WinampCOM.Application")
Winamp.PlaySong("C:\My Music\Elmer Fudd Sings The Blues.mp3")
And no, as far as I know this is not a real song. ;) lol | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #4 on Sat 14 Jun 2003 10:04 PM (UTC) Amended on Sat 14 Jun 2003 10:19 PM (UTC) by Shadowfyr
|
| Message
| Ok.. Tried it and the example in the docs works, but opens an empty Winamp. My version I posted earlier won't. So I tried to look in the API stuff from winamp and the other site, with mixed results. :p
Finally I actually loaded up VB, nose around until I figured out how to get it to see the stupid interface (it has no OCX, so you can't use the object browser, but instead add it as a 'reference'...). Here is what I finally got:
Items you can read or set:
Boolean .Autoload - ?? No idea.
Long .CurrentPos - ?? Either position in the 'song' or the 'playlist'. Not sure.
Bool .EqEnabled - Equalizer use status.
Long .EqPosition - ?? Not sure.
Bool .EqualizerVisible - Hide/show the equalizer.
Bool .MiniBrowserVisible - Hide/Show MiniBrowser.
Long .PlayListPos - Current song location in playlist.
Bool .PlayListVisible - Hide/Show playlist.
Long .PreAmpPosition - Change Pre-Amp amount.
Bool .RepeatStatus - Repeat On/Off.
Bool .ShuffleStatus - Shuffle On/Off.
String .SkinName - Get/set skin.
Bool .Visible - Show/hide winamp.
Commands:
.AddFile ("Filename") - Add a new file to the current playlist.
.ChangeDirectory("Directory") - Change current song directory.
.ClearPlayList - Remove all the files in the current list.
.FastForward
.FastFwd5Secs
.Pause
.Play
.Rewind
.Rewind5Secs
.SendCommand (Command) - See the API docs (basically does same thing as the
commands I am listing here, maybe some other things).
.SetPanning(Long) - Haven't a clue.
.SetVolume(Long) - Sets Winamp's Volume.
.StartPlugin("Name") - Starts up a winamp plugin.
.Stop
.ToggleRepeat
.ToggleShuffle
Read only:
Long = .BitRate - Bit rate the current song is playing at.
Long = .Channels - ?? Not sure.
String = .CurrentSongFileName
Long = .CurrentSongLength
String = .CurrentSongTitle
String = .ID3Tag(Long) - Get specific tag for this song.
Long = .PlayListCount - Number of songs in playlist.
Long = SampleRate - Get sample rate.
String = .SongFileName(Position) - Get filename of song in 'Position' within playlist.
String = .SongTitle(Position) - Get name of song in 'Position' within playlist.
Status = .Status - May return an array, but not sure.
Long = .Version - Plugin version or winamp??
Also, there is a SongChange event. Normally you would do:
sub SongChange
'Do something...
end sub
in VB however, since the scripts 'sleep' when Mushclient is not using them, I am not sure if external events of objects connected to such a script will also 'wake' the script. Either the script would respond and do what you want or simply fail to do anything in responce to the event.
So.. To fix my incorrect example, this would play a song:
Winamp = createobject("WinampCOM.Application")
Winamp.AddFile("C:\My Music\Elmer Fudd Sings The Blues.mp3")
Winamp.Play | | Top |
|
| Posted by
| Sleeve
(31 posts) Bio
|
| Date
| Reply #5 on Sat 14 Jun 2003 11:15 PM (UTC) |
| Message
| | Wow, thanks so much Shadowfyr! I like the dll you provided much better than the one I previously found. I was playing around with it and I got a few things to work but now with this one, it's a lot easier. I appreciate you taking the time to research it and help me out. Thanks! | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #6 on Sun 15 Jun 2003 12:14 AM (UTC) Amended on Sun 15 Jun 2003 12:15 AM (UTC) by Shadowfyr
|
| Message
| No problem. Was interested myself. Just remember to make the 'set winamp = createobject("winampCOM.application")' line global by placing it outside other things. Not a big deal since I experimented and found that the script really does 'sleep' and won't recieve the SongChange event. However, it makes things easier since otherwise you would have to execute that line each time you wanted to reconnect to winamp. By making it global you can just use the commands by themselves. ;)
As for faking the ChangeSong event.. You could use a 1 second timer to test the current PlayListPos with the last one you had and when they differed do whatever you want when the song changes. One point to consider though. If you load a playlist, then it should reset the 'current' song to "", so it will see the new song being played, otherwise if it was on playlist position 1 and you load the new list, then it will still be on 1 and not do anything. Oops.. ;) | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #7 on Sun 15 Jun 2003 01:57 AM (UTC) |
| Message
| Some addendums>
.ToggleRepeat and .ToggleShuffle don't work. They generate a 'method not supported' error. Just use RepeatStatus and ShuffleStatus with vbTrue and vbFalse to set these.
.FastForward and .Rewind actually have the effect of jumping to the Next and Previous track. | | Top |
|
| Posted by
| Sleeve
(31 posts) Bio
|
| Date
| Reply #8 on Sun 15 Jun 2003 02:09 AM (UTC) Amended on Sun 15 Jun 2003 02:11 AM (UTC) by Sleeve
|
| Message
| | Yeah, I found out those don't work too. :) What I ended up doing was using SendCommand and sending the message code from the Winamp 2.x API for the desired effect. So for example, to toggle shuffle, I would just do SendCommand(40023) and that would do it. | | Top |
|
| Posted by
| Poromenos
Greece (1,037 posts) Bio
|
| Date
| Reply #9 on Sun 15 Jun 2003 12:40 PM (UTC) |
| Message
| | RepeatStatus = Not RepeatStatus works for toggling... Assuming it returns the status and that it can be set to it. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #10 on Sun 15 Jun 2003 07:42 PM (UTC) |
| Message
| | Yes. That would actually work. | | Top |
|
| Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
| Date
| Reply #11 on Thu 03 Jul 2003 05:52 PM (UTC) |
| Message
| Ok. Bit of a warning...
Since scripts 'sleep' when Mushclient it not calling them you can't use the event OnSongChange that the COM control supports. I found a way around this by having my script periodically check CurrentSongTitle for a change and updating the display I use on the info bar to reflect the shift.
The problem I ran into involves what happens when you try to shut down Winamp. There seems to be some sort of issue with the COM control being still active and you attempting to shut down Winamp. Sometimes it shuts down, sometimes it hangs winamp and if the com object is still there will also hang Mushclient the moment it makes any attempt to send a request to the hung Winamp process that can't properly shut down. In another resent thread I used winamp.SendCommand("40001") to attempt to shutdown winamp from an alias, this proved to be a mistake, since for it to work the COM object must still exist and thus risks causing the bug. I also found the same issue in some cases where I shut it down from in Winamp itself, but the COM object was still active in the script.
My current theory is that the interface for the plugin that provides access to these commands is still operational once Winamp 2.0 has started closing. A command it can no longer respond to (probably one of my CurrentSongTitle requests) arrives and it hangs. Everything seems fine, Winamp seems to have closed (but is actually hiding in the task manager as Winamp (Not responding)' and not only does clearing the handle using winamp="" fail, but the next attempt to send a command through it hangs Mushclient.
However, this is just a theory. I really am not sure what is realy causing it, except that you should avoid closing winamp manually unless you are sure you have first nuked the object handle that connects Mushclient's script to the winamp COM control. If you don't, then you are eventually going to have a nasty surprise that can only be fixed by using the task manager to manually kill both the hung Winamp and Mushclient. | | Top |
|
| Posted by
| MattMc
USA (54 posts) Bio
|
| Date
| Reply #12 on Wed 21 Sep 2005 05:34 AM (UTC) |
| Message
| A friend and I made a really indepth Winamp Control script. Here's a link to it's posting, of which you'll be required to login to view but here's some login credentials for you guys :)
Site: http://www.aodojo.com/mb/viewtopic.php?t=5546
Username: mushclient
Password: nickrocks
Please don't abuse this login, or I'll suspend the account and everyone'll have to sign up for a unique account, which is dumb.
IMPORTANT: If you try to goto that link and login, it'll say the topic no longer exists. Just repaste the URL after logging in and you can view the topic.
Edit: I posted this in another thread, which the thread was offtopic, and someone directed me to this thread, so I'm reposting this here. It's a nifty plugin, ya'll will enjoy it. One of the high points uses timers in Mush to automatically show the song info for the songs as they play through your list in game. | | 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.
45,381 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top