ActiveWinamp Scripting Reference (Rev. 1)

This documentation is horribly outdated - you should use an object browser (ie OLEview, or the freeware iTripoli Type Library Viewer) to view the type library information of gen_activewa.dll for better documentation

ActiveWinamp (gen_activewa.dll) written by ShaneH. Documentation written by Saivert. Wikified by osmosis.

Here is the complete listing of all methods and properties as of version 0.3:

Notes

All examples are written in VBScript (Visual Basic Scripting Edition), but should be easy to rewrite in JScript (aka JavaScript, ECMAScript).


Methods and Properties list

The main object is “Application” but usually you don’t have to specify this when writing your script. Here are two examples:

Example using complete object names:
' Returns the Media Item for the current song
Set mi = Application.Playlist(Application.Playlist.Position)
Examples using only what is required (since "Application" is default).
' Returns the Media Item for the current song
Set mi = Playlist(Playlist.Position)
Only use "Application" in front to resolve naming conflicts and of course when writing event handlers, like:
Sub Application_ChangedVolume

End Sub

Main events


ChangedTrack
  • Triggered when Winamp starts playing a new song
ChangedVolume
  • Triggered when volume (and also balance/panning) changes
ChangedStatus
  • Triggered when user stops, pauses and/or starts playback
PlaybackEOF
  • Input plugins send this when they are done playing back
Examples:
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile("c:\songlog.txt", ForAppending, True)

Sub Application_ChangedTrack
Set mi = playlist(playlist.position)
MyFile.WriteLine(mi.ATFString("%artist% - %title%") + vbNewLine + mi.ATFString("BitRate = %bitrate%"))
End Sub

Main properties


Playlist
  • Gives access to the playlist, see below for further info
MediaLibrary
  • Gives access to the media library, see below for further info
Volume
  • Adjust/get the volume in the range 0-255 (where 255 is max and 0 is min)
Panning
  • Adjust/Get the balance level (aka panning).
  • 0 is center, -127 is all left and +127 is all right
Hwnd
  • The window handle of Winamp’s main window. Use for miscellanous stuff.
PlayState
  • Returns the playback status. Returns 1 if playing, 3 if paused, 0 if stopped
Skin
  • Get or set the current skin
Shuffle
  • Get or set the current shuffle status (boolean)
Repeat
  • Get or set the current repeat status

Main methods


SayHi
  • Does nothing really...but it’s there!!!

Playback methods

Play
  • |> Starts playback, or restarts if currently playing.
  • Use PlayState property to check this.
StopPlayback
  • [] Stops playback
Pause
  • || Pauses playback
  • |< Steps back to previous song
  • >| Skips to next track

Timer methods

SetTimeout(timeout in ms, funtion to call)
  • Use GetRef() to obtain a reference to a function, like GetRef(MyFunction)
  • Returns a timerid you can use with CancelTimer.
CancelTimer(timerid)
  • Give it the timerid you got from SetTimeout to cancel the timer.

INI file and directory methods

GetIniFile
  • Returns full path and filename to winamp.ini
GetIniDirectory
  • Returns the directory to where you can store your config files

Miscellanous methods

ExecVisPlugin(filename and index to vis)
  • Call it like this: “vis_avs.dll,0” or “vis_plugin,2”
RestartWinamp
  • Restarts winamp. Dont do anything fancy after this call as the script will terminate.
ShowNotification
  • Displays the Song notification popup used in Winamp Modern skin (and skins which clones this).
GetWaVersion
  • Returns an integer representing the current version of Winamp
GetSendToItems
  • Returns a list of items added to the Send To menu.
SendMsg(msg, wParam, lParam)
  • Used to send a message to the Main Window of Winamp.
  • msg=Message number/ID
  • wParam=First message parameter
  • lParam=Second message parameter
PostMsg(msg, wParam, lParam)
  • Same syntax as SendMsg, except the message is “posted” and will return immediately.
RunScript(scriptfile)
  • Executes the script named “scriptfile”
UpdateTitle
  • Winamp will update information about the current title

Playlist methods and properties

This applies to the Playlist object which you get by using the Playlist property on the main object (Application).

Playlist / Properties


Count
  • Number of playlist entries
Item(index)
  • Returns a MediaItem object for the playlist entry
Position
  • Gets the current playlist position. Set it to change playlist position.
Hwnd
  • The window handle of the playlist editor window.

Playlist / Methods


GetSelection
  • Returns an collection of the selected playlist items (highlighted)
Clear
  • Clears the playlist, removing all playlist items.
DeleteIndex(index)
  • Removes the specified playlist item. DeleteIndex(3) deletes the third item.
SwapIndex(from, to)
  • Swaps the playlist item <from> with <to>
FlushCache
  • Flushes the playlist cache, re-reading all titles.
SendMsg(msg, wParam, lParam)
  • Used to send a message to the Main Window of Winamp.
  • msg=Message number/ID
  • wParam=First message parameter
  • lParam=Second message parameter
PostMsg(msg, wParam, lParam)
  • Same syntax as SendMsg, except the message is “posted” and will return immediately.

Media item

A media item is an item that contains properties and methods for accessing an item in the media library and playlist.

Media item / Properties


Name
  • Name of the media item.
Filename
  • The media items’s filename.
Position
  • The position of the item in the playlist
Title
  • Title of media item (song name).
Artist
  • Media item’s Artist field.
Album
  • Media items’s Album field.
Rating
  • User’s rating of media item.
Playcount
  • The media item’s playcount (how many times the song has been played) field.
DbIndex
  • Index of this media item in the media library.
Length
  • Length of media item in seconds
Track
  • Media item’s Track field.
LastPlay
  • Last recorded date this media item was played.

Media item / Methods


ATFString(ATFSpecification)
  • Returns a title string formatted using <ATFSpecification>.

See http://www.winamp.com/support/help/50/atf/atf_help.htm for the ATF specification (Winamp’s Advanced Title Formatting).

Enqueue
  • Adds the media item to the playlist.
Insert(index)
  • Inserts the Media items at the position <index> in the playlist.
RefreshMeta
  • Refreshes the Meta data for this Media item.

Media library

The Media Library object can be accessed through the “MediaLibrary” property of the main object (Application).

RunQueryArray(QueryString)
  • Runs a query in the media library and returns an array of the items that match.
GetItem(Filename)
  • Loads an item from the media library by filename.
Item(index)
  • Returns a Media Item for the item <index> in the Media Library.
Hwnd
  • Window handle of the Media Library window


This concludes the documentation.

 
activewinamp/docs.txt · Last modified: 2009/01/07 02:38 by 75.82.163.147
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Music Plugins