Announcement

Collapse
No announcement yet.

Winamp Scripting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #76
    Wow! great plugin. It helped me answer this problem:
    [chronological overview of songs]

    For those interested, I used this script:

    Dim x, s, sy, ey, y, wd

    Set wd = CreateObject("InternetExplorer.Application")
    wd.Navigate2("about :blank")

    wd.document.write "<html><head>"
    wd.document.write "<title>Winamp Chronological Report</title>"
    wd.document.write "</head>"
    wd.document.write "<body bgcolor=black text=#CEFFCE>"
    wd.document.write "<p><table border=1 cellpadding=0 cellspacing=0>"

    sy = 1949 'start year
    ey = 2004 'end year

    mlq = medialibrary.runqueryarray("YEAR > 1 AND YEAR < " & sy)
    x = 0

    For Each track In mlq
    x = x + 1
    Next

    wd.document.write "<tr><td>before "& sy & "</td><td align=right>" & vbNewLine
    wd.document.write x & "</td></tr>" & vbNewLine

    For y = sy To ey
    mlq = medialibrary.runqueryarray("YEAR = " & y)
    x = 0

    For Each track In mlq
    x = x + 1
    Next

    wd.document.write "<tr><td>" & y & "</td><td align=right>" & vbNewLine
    wd.document.write x & "</td></tr>" & vbNewLine

    Next

    mlq = medialibrary.runqueryarray("YEAR < 1")
    x = 0

    For Each track In mlq
    x = x + 1
    Next

    wd.document.write "<tr><td>no year</td><td align=right>" & vbNewLine
    wd.document.write x & "</td></tr></table>" & vbNewLine


    wd.document.write "</body></html>"
    wd.visible = True

    (I based it on earlier mentioned scripts as you can see)

    Comment


    • #77
      Have made a couple modifications to allow external scripting (ie standalone WSH scripts and VB apps etc).

      It will only work if Winamp has already started, otherwise it annoyingly tries to download the component because it thinks it doesnt exist. You can just run winamp.exe to ensure it is loaded before trying to access it.

      I can fix this by registering it in the registry, but will try work out something different. Its probably a bit buggy, but seems to work for the most part. Have also added a simple volume property and track property to media items, plus a couple other example scripts.

      Set wo = GetObject("clsid:1C7F39AF-65C0-4C14-A392-6B4714705DC2")
      wo.play
      Attached Files
      Last edited by shaneh; 18 September 2004, 15:02.
      Music Plugins

      Comment


      • #78
        Fixed class registration, also registers in the registry. You can now access it properly from external scripts and apps etc.

        ---
        Set wo = CreateObject("ActiveWinamp.Application")
        wo.play
        ---

        Added a dialog to see running scripts and let you kill them off. Good to see if any scripts havent quit properly. You can also run arbitrary scripts from this dialog. Accessed from the config screen for the plugin under general plugins, preferences. I will enhance this dialog and make it more accessible over time.

        Other misc fixes.
        Attached Files
        Music Plugins

        Comment


        • #79
          Damn neFAST's wide post :-(

          Heres a script that gives you easy access to the scripts folder.
          It will work on all systems without modification because it uses the registry to find out where Winamp is kept on your computer.

          code:

          ' Opens the script folder
          ' Written by Saivert

          Const StrRegKey = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp\UninstallString"

          Dim WshShell, path
          Set WshShell = CreateObject("WScript.Shell")

          path = Application.GetIniDirectory & "\plugins\scripts"
          WshShell.Run path

          quit

          Also a script that launches Winamp and makes it play at startup (external).

          code:

          ' Launches Winamp and makes it play
          ' Written by Saivert

          ' The following constant must be on one line:
          Const StrRegKey = "HKLM\Software\Microsoft\Windows\
          CurrentVersion\Uninstall\Winamp\UninstallString"

          Dim fso, WshShell, path
          Set fso = CreateObject("Scripting.FileSystemObject")
          Set WshShell = CreateObject("WScript.Shell")

          ' Detect path to Winamp using registry
          path = fso.GetParentFolderName( WshShell.RegRead(StrRegKey) )

          WshShell.Run path + "\winamp.exe"

          Set wo = CreateObject("ActiveWinamp.Application")
          wo.play


          Good work ShaneH!!!
          Last edited by saivert; 21 September 2004, 07:29.

          Comment


          • #80
            +Tweaked the registration a bit more, the type library is now registered which means .cpp clients will actually work.

            Ive used the wrong type for a lot of stuff (VARIANT), I thought this was best for scripts, but I think it doesnt matter. Making them types like LONG/BSTR/INT etc will make writing CPP clients much easier, especially with later versions of VS. So I will probably convert a lot of stuff, it makes it easier to see what types the functions return and take easier too.
            Attached Files
            Music Plugins

            Comment


            • #81
              A simple example in MFC/Cpp which uses the component. Be careful about writing anything significant at this point in time, as functions and library names etc are expected to change.
              Attached Files
              Music Plugins

              Comment


              • #82
                How do you get the so called "script helper" loaded as a Media Library plugin? gen_script1.dll does not export winampGetMediaLibraryPlugin.

                Comment


                • #83
                  There are IPCs to add and remove media library plugins. An ML helper plugin was necessary in order to get the 'send to' items.
                  Music Plugins

                  Comment


                  • #84
                    You mean through this:
                    code:

                    These are reverse engineered, so may not be supported
                    too well or entirely accurate.


                    long libhwndipc = (LONG)SendMessage(hwndWinamp,
                    WM_WA_IPC, (WPARAM)"LibraryGetWnd",
                    IPC_REGISTER_WINAMP_IPCMESSAGE);

                    And then using the standard ML_IPC_* like:
                    code:

                    /* pass a winampMediaLibraryPlugin *.
                    Will not call plugin's init() func.
                    YOU MUST set winampMediaLibraryPlugin->hDllInstance to NULL,
                    and version to MLHDR_VER
                    *
                    #define ML_IPC_ADD_PLUGIN 0x0750
                    #define ML_IPC_REMOVE_PLUGIN 0x0751 /* winampMediaLibraryPlugin *
                    of plugin to remove. Will not call plugin's quit() func */

                    Comment


                    • #85
                      Yep
                      Music Plugins

                      Comment


                      • #86
                        That's very assuring!! Now I can finally get on the train home (I'm sitting at school). Bye, will be back tomorrow...

                        Comment


                        • #87
                          awww....

                          what a waste of time :P

                          It reminds me of a plugin I intended to write a while back but never did. One of these days I will... Should be pretty good if it works out. Will see how I go for time.

                          ---------
                          Const ForReading = 1

                          Set fso = CreateObject("Scripting.FileSystemObject")
                          Set MyFile = fso.OpenTextFile("C:\art.txt", ForReading, True)

                          Do While MyFile.AtEndOfStream = False
                          artline = MyFile.ReadLine
                          if artline = "" then
                          artline = " "
                          end if
                          set sep = LoadItem("x:" + artline + ".x")
                          sep.Enqueue
                          Loop

                          MyFile.Close

                          quit
                          Attached Files
                          Music Plugins

                          Comment


                          • #88
                            Oh what a cute little teddy...

                            Maybe you could write a quote of the day script too, that will randomly drop lines from a quote file and scatter it around in the playlist. Would be very similar to the teddy script.

                            Comment


                            • #89
                              in the atfe thread, i thought it would be cool if you could save atf strings, and change them whenever you want(from the playlist window) would that be possible through scripts(and if it is, would it be possible to update all the files once you change atf strings)
                              There is no reset button on life... but the graphics kick ass

                              Comment


                              • #90
                                shaneh - excellent work - I was casting about for a way for controlling winamp on my server - didn't like any of the existing stuff out there, so started writing my own using .net remoting - this has saved me a *ton* of effort, thanks!

                                One request, or maybe I'm just missing it - can you add a "current playback status" property (i.e., Stopped, Paused, Playing)?

                                Thanks again,
                                FarmerDave

                                Comment

                                Working...
                                X