No announcement yet.

Winamp Scripting

  • Filter
  • Time
  • Show
Clear All
new posts

  • Really appreciated the quick reply shane. I will try the dependency walker as soon as I get access to that machine again. As for what I couldn't figure out I've got to go through the code and will let you know. Could it possibly be a conflict between active WA and gen_scripting.dll. Works great on XP.

    Does the release version on contain the support for multiple instances of winamp, or is that still being worked on.

    Little background. I've been a karaoke/disc jockey for twenty years and recently had major surgery and cannot work right now so decided to have a go at creating the ulitmate software (IMHO) benefiting from my years of experience.

    Thanks for the excellent software/support.


    • I don't think it is a conflict problem. At the very least you should be seeing it in the list, so I suspect it is a failure to load the .dll problem.

      The multiple instance support is kind of difficult, its currently not supported in the cvs version, and the version posted in here that has the support has a variety of other problems. Im not sure whether I will support it, there are various technical reasons why not. will see.

      You might be interested in taking a look at MediaMonkey for your purposes, it has some nice inbuilt scripting support and is in active development unlike Winamp. It also supports a lot of winamp plugins. Not sure about the multiple instance support though.
      Music Plugins


      • Thanks Shane I'll check it out.


        • Re: About the multiple instancing problem
          When someone call the ActiveWinamp object when Winamp is not running, is it launching Winamp with the /class parameter then? Maybe it could do this to make sure it know which Winamp it is controlling. And you could call a method on the ActiveWinamp root object called SetWinampClass(string) that tells the object which Winamp to use. Just an idea.

          And can you use the Window Station/Desktop API to obtain the handle of a running Winamp when the ActiveWinamp object is called from ASP script? Maybe it requires the "Allow interaction with logged on user" privilege or something similar. Or maybe the only way for a process that is started under a non-logged on user (i.e. SYSTEM, or IADM_USR, whatever) to communicate with a program running under the logged on user is by using named pipes.


          • The problem is quite tough. I havent actually seen an app which handles it too well. Being a single document interface app, with the possiblity of being launched in either single instance or multiple instance mode makes it even trickier.

            Coupled with the fact the COM server is handled in a .DLL which is part of an EXE which actually itself isn't a COM server doesn't help. Ive been thinking about making the COM server another .exe which actually launches winamp.exe (possible with a /class param), or just have the /class included as a param for the com server.

            Knowing which instance of winamp AW is controlling isn't really much of an issue, as it can just control the in-process instance. The trouble is the way AW grabs this instance is by registering, then getting, the active object. Its the 'active object' problem that is causing issues, and seems to cause issues for many com servers.

            Feel free to checkout the source and have a go at implementing it. You will want to look into monikers too probably. And make sure it works with 'createobject' and 'getobject', in both single instance and multiple instance mode. And when winamp isn't and is already running.

            Anyway, its complicated...
            Music Plugins


            • Once again I need a little help shane. How can I get the length of the currently playing song from your plugin. This is so I can figure the percentage played and near the end (94%) load the next song.

              I did try Media Monkey but I found it not as stable as Winamp. To get around my previous problem I am using Winamp 2.95 with gen_scripting.dll and Active_WA on winamp 5.08. This gives me the multiple instances I needed. Thanks for any help.


              • You can just use the .length property of a media item. ie, playlist(3).length


                set mi = loaditem("C:\song.mp3")

                or wherever else you obtain a media item. Im not sure if works perfectly if the item isn't in your ML, but hopefully it will.

                Be warned that the length is often wrong. This will be the case regardless of whether you are using this plugin or not. Even winamp displays the wrong time sometimes and the 'time remaining' display just works in over time as it tries to catch up. I have no idea why this error occurs, something to do with the .mp3 format and difficulty in getting an accurate time I suppose.

                The other way is to poll winamp for the length and time elapsed etc, it tends to get more accurate the longer the item is played. You probaly wont find an elegant solution to what you are trying to do, no-one else has.

                Use this with SendMsg. ie:

                #define IPC_GETOUTPUTTIME 105
                /* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
                ** returns the position in milliseconds of the current track (mode = 0),
                ** or the track length, in seconds (mode = 1). Returns -1 if not playing or error.

                length = SendMsg(1024, 1, 105)
                Music Plugins


                • Maynard Script Collection 0505

                  Attached is a zip file containing some scripts I've created. Hope they are useful...
                  • sendto_File Copy.vbs - Copies selections in Media Library to specified destination folder.
                  • sendto_File Move.vbs - Moves selections in Media Library to specified destination folder.
                  • sendto_File Delete.vbs - Batch deletes selections from Media Library without warning prompts for each file as does the standard WA delete operation.
                  • sendto_MP3Gain.vbs - Launches MP3Gain with selections in Media Library.
                  • sendto_Nero Cover Designer.vbs - Launches Nero Cover Designer with selections from Media Library and populates NCD layout with Artist/Album/Track info.

                  Change Copy/Move operations to use configurable ATF for folder destination (ex. <Artist>\<Album>\<File>)

                  Attached Files


                  • Nice contribution maynardkrebs, you can also add scripts to the ActiveWinamp wiki to easily update/share/have others edit etc.

                    I hope to have a new release of AW out sometime soon, as there are quite a few bugs already fixed in the CVS version. You should definetely use the version available in the CVS at the sourceforge site, as some bugs that have been fixed are a bit problematic.
                    Music Plugins


                    • hey shane.

                      Glad you found a home for AW. Thanks for tip on latest versions at sourceforge.



                      • Attached is a zip file containing a script I've created. Hope it is useful...

                        startup_randsong.vbs - Random play of current playlist, needs regsvr32 MersenneTwister.dll to use.

                        and MersenneTwister.dll is a fast random number generator in ActiveX DLL form.
                        Attached Files


                        • Here's is a "iTunes party suffle"-like i wrote.
                          Use it in combination with a playlist containing
                          PHP Code:
                          #EXTINF:-1,X:\¯¯¯¯¯¯Party Shuffle______________________
                          X:\¯¯¯¯¯¯Party Shuffle______________________.
                          I plan to check the number of tracks in playlist to maintain its size to 25
                          PHP Code:
                          ' +----------------------+
                          |     Party Shuffle    |
                          ' +----------------------+
                          Automatically enqueues a new song each time a song is played.
                          ' Brought to you by neF4ST

                          Dim mlq,mlq2,artist,tracks

                          ' "smart" 
                          random slightly faster with big libraries
                          medialibrary.runqueryarray("type = 0 and trackno = 1")

                          Sub Application_ChangedTrack 

                          if playlist(1).filename="X:\¯¯¯¯¯¯Party Shuffle______________________.x" then

                          if playlist.position=1 then
                          ' This is the first launch
                          we add 20-1 songs
                          do while (tracks<=19)
                          Rand Int(ubound(mlq)*Rnd+1)
                          mlq2 medialibrary.runqueryarray("artist = """ mlq(Rand).artist """")
                          Rand2 Int(ubound(mlq2)*Rnd+1)
                          'now let's play

                          playlist.position>5 then
                          ' We add a new song
                              Rand = Int(ubound(mlq)*Rnd+1)
                              mlq2 = medialibrary.runqueryarray("artist = """ + mlq(Rand).artist + """")
                              Rand2 = Int(ubound(mlq2)*Rnd+1)

                          We remove the first song of the playlist
                          end if

                          end if

                          End Sub 


                          • Another dumb question

                            Shane I got another dumb question for you. The song that is currently playing in Winamp when there is a blank playlist. Is there a way to get artist tile for the currently playing song.

                            i.e. Someone uses the loadfile dialog from the winamp interface. Calls to the playlist.item.whatever show up as member item does not evalueate to object. Thanks


                            • My big rant which will tick DrO off: Flaws in API

                              Using Load file dialog (or as I like to call it Open Song) will add the song to the playlist. Winamp always does this. It first clears the playlist, then adds the song to it and starts playing. If someone clears the playlist while the song plays, no info about song can be retrieved as the playlist is empty.

                              Winamp has major flaws in it's API and currently no one at Nullsoft is caring shit about it. I wished Peter Pawlowski did something to the API the short time he spent at Nullsoft, but nooo. Instead he got fed up and started on his own player (Foobar2000) which has an extensive C++ class based API more powerful than Winamp can ever dream of with it's simple window message/struct system.

                              I'm also wondering if I should quit Winamp development and focus on one of the more up to date players. Maybe give fb2k/MediaMonkey a try. Implement free form skinning for fb2k based on code from the Wasabi project (which was a good start but lacked a dedicated dev team).

                              Just my 2 cents...


                              • hey shane, ive learned to make a few scripts from all of your examples, but have yet to understand how to do 2 things in one script.

                                I (and others asking in tech support) would really like it if you could provide a 'sort by album and then track' script.

                                many thanks