I wrote a simple mIRC "now playing" script using the COM Automation server. I only tested it with mIRC 6.31.
Feel free to include the script in the distribution and to edit the comments at the top as appropriate.
; Basic interface to the foobar2000 COM Automation Server component
; Only works with the 0.7 series of the fb2k COM Automation Server
;
; Currently only allows getting title formatted strings, but can be extended
; Mostly useful for now-playing scripts
;
; Script written by Niels Hansen (jfs) and may be freely distributed without limitations
alias -l fb2k_ensure_open {
if ($com(fb2kPlayback) != fb2kPlayback) {
if ($com(fb2k) != fb2k) {
echo -a * foobar2000 COM object not open, opening...
.comopen fb2k Foobar2000.Application.0.7
if ($comerr == 0) {
echo -a * Opened foobar2000 COM object
}
else {
echo -a * Failed opening foobar2000 COM object
halt
}
}
echo -a * foobar200 Playback COM object not open, opening...
if ($com(fb2k,Playback,3,dispatch* fb2kPlayback) == 0) {
echo -a * Failed opening fooobar2000 Playback COM object
halt
}
else {
echo -a *Opened foobar2000 Playback COM object
}
}
}
alias fb2k_get_current_format {
fb2k_ensure_open
var %res = $com(fb2kPlayback,FormatTitle,1,bstr,$1-)
if (%res) {
return $com(fb2kPlayback).result
}
else {
echo -a * Failed getting title data from foobar2000
halt
}
}
alias fb2k_get_current {
if (!%fb2k_default_format) {
set %fb2k_default_format $chr(37) $+ artist $+ $chr(37) - $chr(37) $+ title $+ $chr(37)
}
return $fb2k_get_current_format(%fb2k_default_format)
}
alias fb2k {
say fb2k: $fb2k_get_current
}
If you want to use the script as-is and aren't much into mIRC scripting:
You need to insert the script as a Remote script, not on the Aliases tab in the script editor but in the Remote tab.
Then use the command /fb2k to display what you're listening to in foobar2000
You can go to the Variables tab in the script editor and change the %fb2k_default_format variable to a different title formatting string to make the script show something else.