Announcement

Collapse
No announcement yet.

Winamp Scripting

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

  • Winamp Scripting

    Just a quick update cause I have to leave. This is the start of some scripting support I am adding to Winamp. You cant do much with it yet, and it can only run one script at a time (it currently stays running to recieve events, so the scripting object isnt deleted thus not freed etc). And is a fair bit buggy when the script borks.

    Anyway, paste this into the scripting window to see it at least do something. Requires Word.

    Set wd = CreateObject("Word.Basic")
    wd.appshow
    wd.filenew
    WAobj.SayHi
    WAobj.Play

    Sub WAObj_ChangedTrack
    wd.Insert "New Track...."
    End Sub

    Obviously this will be much more complete over time, and allow heaps of stuff. In particular the ability to run scripts concurrently, and to be invoked from menus with arguments etc.
    Attached Files
    Last edited by shaneh; 28 August 2004, 05:49.
    Music Plugins

  • #2
    The plug-in doesn't appear to be loaded. I tried to run "REGSVR32 gen_script1.dll", but that didn't work. Any suggestions?

    Comment


    • #3
      Theres no registering involved, its all self contained. The type library is a resource in the .exe.

      Its probably just a weird version thing. Im using xp sp2 with vs.net 2003 installed. Thus it uses all the latest CRTs etc.

      Ill update a new version, its a bit buggy though. It does allow you to do some stuff with the playlist though:

      Like;

      set x = playlist
      msgbox x(3)

      msgbox playlist.count

      for each track in playlist
      msgbox track
      next

      and so forth. Im using standard names for automation where possible so you can use some of the nicer things in vbscript etc. (note it currently crashes for some reason when using the 'for each' stuff).

      It currently leaks memory just to make life easier, I'll fix it up later. It kills the object after the script is finished currently so events will appear not to be working.
      Attached Files
      Music Plugins

      Comment


      • #4
        I'm using Windows XP Professional with SP-1 only (Build 2600.xpsp2.030422-1633: Service Pack 1) as reported by winver.
        It says xpsp2 cos' of Windows Update. I have not installed the complete Service Pack 2 (standalone installer), which is not out yet. And I don't have "vs.net 2003" either. What's the deal??

        Comment


        • #5
          The standalone installer for sp2 has been out for some time... I installed it a few weeks ago. MS has it on their site.

          But I doubt that would be the problem, its probably the lack of vs.net2003. Do you have MSVCR71.DLL in your windows system directory? (note the '1'). It requires that at the moment, I'll link it statically later on, or use the older CRT.
          Music Plugins

          Comment


          • #6
            Heres a version that links msvcr71 statically so the dll isnt needed. (the .dll should be able to be installed with the .net framework if you want it). It also fixes the crash when using 'for each'. Events will work in this one too.

            EDIT: removed some .reg stuff form the .dll which wasnt needed. and fixed some windowing problems.
            Attached Files
            Last edited by shaneh; 30 August 2004, 10:34.
            Music Plugins

            Comment


            • #7
              Thank! This helped a lot.
              I didin't find SP-2 on Windows Update. They claimed it would be installed automatically if I had Automatic Updates turned on for Windows Update. I'll search for it on their search page. Maybe you have the URL??

              You are using IActiveScript and IActiveScriptSite right?? Or are you just using "Microsoft Script Control" ActiveX Control?

              Comment


              • #8
                download, software, update, Microsoft, product, computer, PC, Windows, Office, server, MSN, Live, game, Xbox, security, driver, install, trial, preview, demo, popular


                Its 270mb though, the auto-update would come in at less than half that. But I have bandwidth to burn and want to slip stream it so I dont have to redownload it again if i ever format or install another machine.
                Music Plugins

                Comment


                • #9
                  You are on, right this time with me huh!! Noticing the quick reply...

                  Can you explain what the lower edit box is for??

                  Comment


                  • #10
                    I was using it for testing running multiple scripts, its not used at all at the moment. When I start adding some multi-thread support I will make use of it. The final version wont use it at all, but will load stuff up from 'startup_xxx.vbs' and 'changedtrack_xxx.vbs' and 'playlistaction_xxx.js' files etc.

                    At the moment I am trying to get the object design done, its a bit tricky. For example enumerating the track list is complicated by the fact that the list can change at any time. I can cache a copy, but it could potentially be quite large. Currently the 'mediaitem' objects are created on demand, which is nice, but is difficult to manage when the playlist changes.

                    The same will be true of things like 'send to' selecions, media library queries etc.

                    The thread stuff shouldnt be too difficult, I already know how im going to do it, just a matter of actually doing it.

                    As for the replies.. I have my messenger account hooked up to the replies so I get a notification when theres a reply to my thread.
                    Music Plugins

                    Comment


                    • #11
                      Can you compile a list of the methods and properties of WAObj, as I don't have OleView (VC++ not installed at school computers).

                      Comment


                      • #12
                        Theres not really any at the moment, just 'Play' and 'SayHi'. Plus a 'ChangedTrack' event - I may change this to an event on the playlist object instead. The problem with that is it requires a 'playlist' object to be created - and I want to keep the objects as being created dynamically on demand so they arent created if theyre not needed.

                        Then again, theres likely to be only a couple objects that would need to be created like this, so the overhead would be low...

                        Adding new methods takes about 5 seconds, most of them are just sendmessage calls. I want to get the design done properly first.

                        The hard part is managing objects, and internal allocations etc. The playlist problem is a good example, I think I will just use a snapshot when the enumerator is first accessed.

                        + the WAObj is going to be renamed the 'Application' object, in keeping with standard naming conventions.

                        EDIT: There is aslo a 'playlist' property on the waobj. On the playlist object there is a 'Item' 'Count' and a enumerator. The Item takes an index (can also be used like - playlist(index)) which returns a 'MediaItem'.

                        Currently the 'MediaItem' just has a 'Name' property. But I guess it will have stuff like 'Title' , 'Play()' etc.

                        I can submit the .tlb file, but it should be a resource of the .exe anyway.
                        Music Plugins

                        Comment


                        • #13
                          How do I get the title and the index of the current playing item, for use in the event WAObj_ChangedTrack.

                          code:

                          Sub WAObj_ChangedTrack
                          MsgBox "Playing " & WAObj.CurrentSong
                          End Sub

                          Comment


                          • #14
                            You cant :P

                            Not yet anyway. As I said, its just a prototype to show it can be done, not that it is actually done.

                            Eventually you will be able to do stuff like

                            playlist.currentitem
                            or
                            playlist.getcurrent()
                            or
                            playlist.item(playlist.currentpos())
                            or the current playlist position will be passed in the changedtrack event.

                            or whatever I choose to do.. theres many different ways of doing things. Once I get more things done, Ill post a complete list of the object model.
                            Music Plugins

                            Comment


                            • #15
                              A small update with some more interesting stuff. Has the ability to run and stop scripts to make life easier.

                              added:
                              position property to playlist get/set
                              position property to media items
                              filename property to media items
                              title property to media items
                              ATFString method to media items

                              An nice example of it in action:

                              ------
                              Set ieo = CreateObject("InternetExplorer.Application")
                              ieo.visible = true

                              Sub WAObj_ChangedTrack
                              ieo.Navigate2 ("http://www.audioscrobbler.com/music/" + playlist(playlist.position).ATFString("%artist%"))
                              end sub
                              ------

                              Will navigate IE to the artist page on Audioscrobbler on every song change. You could do any action you want on any song with any ATF stuff with whatever event. But this is just a nice example. I'll write something up which parses the page and attempts to enqueue the top song later on.

                              Another simple example:

                              Set wd = CreateObject("Word.Basic")
                              wd.appshow
                              wd.filenew

                              Sub WAObj_ChangedTrack
                              wd.insert playlist(playlist.position).ATFString ("%artist% - %album% '('%filename%')'") + vbNewLine
                              end sub


                              With ATF, a lot of possibilities already exist, so I will work on getting the threading and loading from files working soon. As well as adding items to the playlist right click and send to menu.
                              Attached Files
                              Music Plugins

                              Comment

                              Working...
                              X