You can download it here and install it.
Here is a HUGE example. Most of the functions are here. (I left out the playlist functions)
Code: Select all
Foobar := ComObjCreate("Foobar2000.Application.0.7"),Foobar.Minimized := 1 ;Create the COM object and minimise foobar.
Playback := Foobar.Playback ;The playback handle.
Settings := Playback.Settings ;The settings handle.
MsgBox % Foobar.Name ; The Name and Version.
MsgBox % Foobar.ApplicationPath ;Where Foobar is installed.
MsgBox % Foobar.ProfilePath ;Where foobar settings are.
MsgBox % Playback.IsPlaying ;Returns if foobar is playing or not. -1 if playing, 0 if stopped. (STOPPED not Paused)
MsgBox % Playback.IsPaused ;Returns if playback is paused or not. -1 if paused, 0 if not.
MsgBox % Playback.CanSeek ;Returns if the playback can be seeked. 0 if it cannot be seeked. It's 0 in Radio stations.
Msgbox % Playback.FormatTitle("%title% - %album artist%") ; All of the title formatting is valid here. http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference
Playback.Pause() ;Pauses playback (Has a toggle effect.)
Playback.Next() ;Obvious right?
Playback.Previous() ;Self explanatory
Playback.Random()
playback.Stop() ;This is NOT PAUSE, It's STOP. They are totally different!
MsgBox % Floor(Playback.Position) ;Display playback time.
MsgBox % Floor(Playback.Length) ;Display playback length.
MsgBox % Floor(Playback.Position) . "/" . Floor(Playback.Length) ;Display PlaybackTime/Length in Seconds.
Playback.Seek(3) ;Set seek onto the 3rd second.
Playback.SeekRelative(-5) ;Go back 5 seconds.
Playback.Seek(Playback.Position-5) ;Also goes back 5 seconds.
Playback.SeekRelative(+5) ;Skip 5 seconds ahead.
Playback.Seek(Playback.Position+5) ;Also Skips 5 seconds ahead.
MsgBox % Floor(100+Settings.Volume)
;Gets the volume. In foobar, the volume is measured differently. If the volume was 99, in foobar it would show as -1. (99-100)
Settings.Volume := Settings.Volume+2 ;Increase the volume by 2 dBs(Most probably Decibals)
Settings.Volume := Settings.Volume-2 ;Decrease the volume.
MsgBox % Settings.CursorFollowsPlayback ;Displays the current, CursorFollowsPlayback Setting of foobar.
Settings.CursorFollowsPlayback := 0 ;Sets the option.
Settings.CursorFollowsPlayback := !Settings.CursorFollowsPlayback ;Toggle the Option.
MsgBox % Settings.PlaybackFollowsCursor ;Displays the current, PlaybackFollowsCursor setting.
Settings.PlaybackFollowsCursor := 0 ;Sets the option.
Settings.PlaybackFollowsCursor := !Settings.CursorFollowsPlayback ;Toggle the Option.
MsgBox % Settings.StopAfterCurrent ;Displays the StopAfterCurrent setting. It can be set,toggled the same way as the previous settings.
MsgBox % Settings.ActivePlaybackOrder ;Displays the current ActivePlaybackOrder. It will be one of these: Default, Repeat (playlist), Repeat (track), Random, Shuffle (tracks), Shuffle (albums), Shuffle (folders)
Settings.ActivePlaybackOrder := "Repeat (playlist)" ;It can be set.
PlaybackOrders:= Settings.PlaybackOrders
MsgBox % PlaybackOrders.Count() ;Displays number of playback orders.
For Order in PlaybackOrders ;Loop through all the orders.
MsgBox %Order%
ComObjConnect(Playback,"Playback_") ;Connect playbacks events to the Playback_ prefix.
ComObjConnect(Settings,"Settings_")
return
;Playback Events.
Playback_Started(){
MsgBox Playback Started.
}
Playback_Paused(newVal){
;The parameter is the New "Playback.IsPlaying" value.
If newVal
MsgBox Playback was paused.
else
MsgBox Playback was Un-paused.
return
}
Playback_Stopped(Reason){ ;Called in when stopped.
Msg := (Reason = "0") ? ("(requested by user)") : ((Reason = "1") ? ("(end of file)") : ((Reason = "2") ? ("(starting another track)") : (Reason)))
;If reason contains:
; 1 -> Requested by User.
; 2 -> End of File.
; 3 -> Starting Another track.
MsgBox Playback has stopped.`n%Msg%
}
Playback_TrackChanged(){ ;Called in when track has changed.
global
Info := Playback.FormatTitle("%title% - %album artist%")
Start := A_TickCount
Loop,
ToolTip,%Info%
until A_Tickcount-Start >= 2000
ToolTip,
return
Info := "",Start := ""
}
Playback_PositionChanged(Pos,Seeked){ ;Called in when the seek changes.
Pos := Floor(Pos)
If Seeked
MsgBox Position changed by seeking. `nNew Pos:%Pos%
;If Seeked=0 that means the song is playing.
}
;Settings Events.
Settings_CursorFollowsPlaybackChanged(newVal){
Display(A_ThisFunc,newVal)
}
Settings_PlaybackFollowsCursorChanged(newVal){
Display(A_ThisFunc,newVal)
}
Settings_StopAfterCurrentChanged(newVal){
Display(A_ThisFunc,newVal)
}
Settings_ActivePlaybackOrderChanged(newVal){
Display(A_ThisFunc,newVal)
}
Display(func,value){
func := RegExReplace(SubStr(func,10),"([A-Z])"," $1")
MsgBox Setting Changed:%func%`mNew Value:%value%
}