Scripting functions are all grouped as methods under the "scripting" property. For example to play a song, you could use something like this:
Set hspiWMP = hs.GetPlugins("Media Player").scripting
hspiWMP.play "Album", "Greatest Hits", "The best song"
"CategoryType" is either "Album", "Artist", "Genre", "Playlist", or "Media Library". For "Media Library", "Category Name" is ignored.
Scripting Function List:
<UL TYPE=SQUARE><LI>Function Play(CategoryType As String, CategoryName As String, Optional Title As String = "") As Long
<LI>Function PlayURL(URL As String) As Long
<LI>Sub PausePlayer()
<LI>Sub ResumePlayer()
<LI>Sub StopPlayer()
<LI>Property Mute() As Boolean
msgbox "Player is muted: " & hspiWMP.Mute
<LI>Property Let Mute(State)
hspiWMP.Mute = true
hspiWMP.Mute = "toggle"
<LI>Property Get LoopMode()
msgbox "Loop Mode is: " & hspiWMP.LoopMode
<LI>Property Let LoopMode(State)
hspiWMP.LoopMode = true
hspiWMP.LoopMode = "toggle"
<LI>Property Get ShuffleMode()
msgbox "Shuffle Mode is: " & hspiWMP.ShuffleMode
<LI>Property Let ShuffleMode(State)
hspiWMP.ShuffleMode = true
hspiWMP.ShuffleMode = "toggle"
<LI>Sub PlayNext()
<LI>Sub PlayPrev()
<LI>Sub Restart()
<LI>Sub FastForward()
<LI>Sub FastReverse()
<LI>Sub Eject(Optional Drive As Integer = 0)
<LI>Sub VolumeUp(Optional Percent As Integer = 10)
<LI>Sub VolumeDown(Optional Percent As Integer = 10)
<LI>Property Let Volume(Percent As Integer)
hspiWMP.Volume = 50
<LI>Property Get Volume() As Integer
msgbox "Volume is: " & hspiWMP.Volume
<LI>Function GetCategoryList(CatType As String) As Collection
<LI>Function GetByCategory(Optional CatType As String = "Media Library", Optional CategoryName As String = "") As Collection
<LI>Property Get PlayerStatus() As String
<LI>Property Get Title() As String
<LI>Property Get Artist() As String
<LI>Property Get Album() As String
<LI>Property Get Genre() As String
<LI>Property Get Length() As String
<LI>Property Get ShowPopupControls()
msgbox "Pop-up controls are displayed: " & hspiWMP.ShowPopupControls
<LI>Property Let ShowPopupControls(State)
hspiWMP.ShowPopupControls = true
hspiWMP.ShowPopupControls = "toggle"
<LI>Property Let FullScreenVideo(State)
hspiWMP.FullScreenVideo = true
hspiWMP.FullScreenVideo = "toggle"
<LI>Function AddToPlayList(Optional Reserved1 As String, Optional Reserved2 As String, Optional Reserved3 As String = "", Optional sPlayListName As String = "HomeSeer")
Adds currently playing song to the playlist.
<LI>Function CurrentPlaylist()
msgbox "The current playlist is: " & hspiWMP.CurrentPlaylist
<LI>Function GetMediaInfo(CategoryType As String, CategoryName As String, Title As String) As Collection
Set hspiMediaInfo = hspiWMP.GetMediaInfo("Artist", "Janet", "Best Song")
MsgBox "Album=" & hspiMediaInfo("Album") & vbCrLf _
& "Artist=" & hspiMediaInfo("Artist") & vbCrLf _
& "Genre=" & hspiMediaInfo("Genre") & vbCrLf _
& "Duration=" & hspiMediaInfo("Duration")
<LI>Function GetAlbumsByCategory(CategoryType As String, CategoryName As String) As Collection
<LI>Sub RefreshLists(CategoryType As String)
hspiWMP.RefreshLists "Artist"
<LI>Property Get WMPObject() As Object
Full access to the WMP object. This object is available as a convenience to extremely advanced developers only. Because of its complexity, technical support for this object is not available. More information about the object can be found at WMP9 SDK[/list]
note: GetAlbumsByCategory requires version 1.0.17 or above
Set hspiWMP = hs.GetPlugins("Media Player").scripting
hspiWMP.play "Album", "Greatest Hits", "The best song"
"CategoryType" is either "Album", "Artist", "Genre", "Playlist", or "Media Library". For "Media Library", "Category Name" is ignored.
Scripting Function List:
<UL TYPE=SQUARE><LI>Function Play(CategoryType As String, CategoryName As String, Optional Title As String = "") As Long
<LI>Function PlayURL(URL As String) As Long
<LI>Sub PausePlayer()
<LI>Sub ResumePlayer()
<LI>Sub StopPlayer()
<LI>Property Mute() As Boolean
msgbox "Player is muted: " & hspiWMP.Mute
<LI>Property Let Mute(State)
hspiWMP.Mute = true
hspiWMP.Mute = "toggle"
<LI>Property Get LoopMode()
msgbox "Loop Mode is: " & hspiWMP.LoopMode
<LI>Property Let LoopMode(State)
hspiWMP.LoopMode = true
hspiWMP.LoopMode = "toggle"
<LI>Property Get ShuffleMode()
msgbox "Shuffle Mode is: " & hspiWMP.ShuffleMode
<LI>Property Let ShuffleMode(State)
hspiWMP.ShuffleMode = true
hspiWMP.ShuffleMode = "toggle"
<LI>Sub PlayNext()
<LI>Sub PlayPrev()
<LI>Sub Restart()
<LI>Sub FastForward()
<LI>Sub FastReverse()
<LI>Sub Eject(Optional Drive As Integer = 0)
<LI>Sub VolumeUp(Optional Percent As Integer = 10)
<LI>Sub VolumeDown(Optional Percent As Integer = 10)
<LI>Property Let Volume(Percent As Integer)
hspiWMP.Volume = 50
<LI>Property Get Volume() As Integer
msgbox "Volume is: " & hspiWMP.Volume
<LI>Function GetCategoryList(CatType As String) As Collection
<LI>Function GetByCategory(Optional CatType As String = "Media Library", Optional CategoryName As String = "") As Collection
<LI>Property Get PlayerStatus() As String
<LI>Property Get Title() As String
<LI>Property Get Artist() As String
<LI>Property Get Album() As String
<LI>Property Get Genre() As String
<LI>Property Get Length() As String
<LI>Property Get ShowPopupControls()
msgbox "Pop-up controls are displayed: " & hspiWMP.ShowPopupControls
<LI>Property Let ShowPopupControls(State)
hspiWMP.ShowPopupControls = true
hspiWMP.ShowPopupControls = "toggle"
<LI>Property Let FullScreenVideo(State)
hspiWMP.FullScreenVideo = true
hspiWMP.FullScreenVideo = "toggle"
<LI>Function AddToPlayList(Optional Reserved1 As String, Optional Reserved2 As String, Optional Reserved3 As String = "", Optional sPlayListName As String = "HomeSeer")
Adds currently playing song to the playlist.
<LI>Function CurrentPlaylist()
msgbox "The current playlist is: " & hspiWMP.CurrentPlaylist
<LI>Function GetMediaInfo(CategoryType As String, CategoryName As String, Title As String) As Collection
Set hspiMediaInfo = hspiWMP.GetMediaInfo("Artist", "Janet", "Best Song")
MsgBox "Album=" & hspiMediaInfo("Album") & vbCrLf _
& "Artist=" & hspiMediaInfo("Artist") & vbCrLf _
& "Genre=" & hspiMediaInfo("Genre") & vbCrLf _
& "Duration=" & hspiMediaInfo("Duration")
<LI>Function GetAlbumsByCategory(CategoryType As String, CategoryName As String) As Collection
<LI>Sub RefreshLists(CategoryType As String)
hspiWMP.RefreshLists "Artist"
<LI>Property Get WMPObject() As Object
Full access to the WMP object. This object is available as a convenience to extremely advanced developers only. Because of its complexity, technical support for this object is not available. More information about the object can be found at WMP9 SDK[/list]
note: GetAlbumsByCategory requires version 1.0.17 or above
Comment