Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: COM Automation Server for 0.9 (Read 592817 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

COM Automation Server for 0.9

Reply #100
I do not know RocketDock or how to extend it, but you generally do not need the COM Server plugin unless you want to get data from foobar2000. If you merely want to trigger certain playback functions, you can use the command line interface for foobar2000 (run foobar2000.exe with the /? parameter to get a list of supported commands).


Thanks for the info, although I just tried making shortcuts with those commands, but they didn't work when I moved them onto the dock. I guess it's a RocketDock issue, I should probably go and ask on their forums, if they have any.

COM Automation Server for 0.9

Reply #101
OK I've managed to make some basic controls for RocketDock using the /playpause and /stop arguments (I made icons in RocketDock itself rather than trying to move shortcuts from the desktop), but I am trying to get Stop after Current, and it's not working. I have tried /command:<stopaftercurrent>, /command:<Stop after Current> (but that returned errors saying it didn't know what "after" and "Current" meant) and /playing_command:<stopaftercurrent>, but nothing has worked.

Also, I would like to have the title of the currently playing track in RocketDock, am I able to add commands that this COM automation component can use in either the target (So C:\...\foobar.exe) or the argument (like /play)? I realize you don't know how RocketDock works foosion, (there may be some other stuff I can try) so can you tell me how to send out the information in general, and I'll see if I can get it into RocketDock myself?

Thanks!

COM Automation Server for 0.9

Reply #102
Try:
Quote
foobar2000 /command:"Stop After Current"


Note that foo_comserver cannot 'send' information, it merely allows external scripts and programs to access information. You would need to write a script of some sort, and I have no idea if that is possible with 'RocketDock' or even what RocketDock is.

COM Automation Server for 0.9

Reply #103
Try:
Quote
foobar2000 /command:"Stop After Current"


Note that foo_comserver cannot 'send' information, it merely allows external scripts and programs to access information. You would need to write a script of some sort, and I have no idea if that is possible with 'RocketDock' or even what RocketDock is.


Thank you! I got Stop after Current to work. As for the second thing, am I right in thinking that you have to write the script with the program you want to access this information, or do you have to make this program access the script? Or both? I really know very little about COM automation!

What I'm looking for is some general idea of how to write a script that accesses this information, then I'll try and get RocketDock to use it. RocketDock is pretty win though, it's like the dock you get on Macs but better. And you can control Foobar from it!

COM Automation Server for 0.9

Reply #104
The COM server comes with some script examples in various languages, If you want to take a look. They are intended for people with scripting\coding\programming experience though.

COM Automation Server for 0.9

Reply #105

Yup, seems to work fine here on RC1, 5728, RC2 and RTM (all build i remember trying it on).


strange... i'm on RTM and ive tried to register it. But when i look at Preferences > Tools > Com Automation server it says the server is " Not Running: Operation unavailable" and all three paths are " Not available".

thanks for the reply btw


This is exactly what I get too, XP Home SP2, running admin.
I had comserver installed before (dunno which version), and uninstalled both COM and foobar x.x.x.3 and then installed foobar x.x.x.5
I installed comserver (latest version), and it shows up in my component list for foobar but it says what I quoted above.

I dont have foobar installed in D:\program files\foobar2000 (D:\ is the main hdd) but instead C:\foobar
How do I reregister it?

COM Automation Server for 0.9

Reply #106
As the readme says, You launch foobar's main executable with the /regsvr:comserver2 argument.

Again, In every Vista version i tried, and currently on SP1 RC1, I've not experienced that issue at all. Try re-registering and see what you come up with.

COM Automation Server for 0.9

Reply #107
can i use vbscript to display fb2k's current volume level?

COM Automation Server for 0.9

Reply #108
nvm

COM Automation Server for 0.9

Reply #109
The features says that it can perform the default action on a playlist entry, how do you inplement that? It wasn't in any of the example
I just like listening to music

COM Automation Server for 0.9

Reply #110
Playlist objects have a DoDefaultAction(index) method. The index parameter specifies the item in the playlist on which you want to perform the default action.

COM Automation Server for 0.9

Reply #111
Awesome
I just like listening to music

COM Automation Server for 0.9

Reply #112
As the readme says, You launch foobar's main executable with the /regsvr:comserver2 argument.


Hi,

can someone please tell me what this means and how I do it ?. I'd like to get Foobar to work with an old Creative remote control connected to the Com port...

Thanks
Alex


COM Automation Server for 0.9

Reply #114
This component has nothing to do with COM ports and remote controls. The "COM" in its name refers to Microsoft's Component Object Model.

COM Automation Server for 0.9

Reply #115
This component has nothing to do with COM ports and remote controls. The "COM" in its name refers to Microsoft's Component Object Model.


Ah, I see.

Thank you nevertheless.

Alex


COM Automation Server for 0.9

Reply #117
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.

Code: [Select]
; 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.

COM Automation Server for 0.9

Reply #118
I want to access foobar2000 in a PHP script running on my local Apache. This line seems to work:
Code: [Select]
$foobar2000 = new COM("Foobar2000.Application.0.7");

But var_dump() only outputs this:
Quote
object(com)#1 (0) { }

What could be wrong?

Edit: Never mind. It works. I just didn't know that COM objects have invisible methods and values.

COM Automation Server for 0.9

Reply #119
Is it possible to know if a certain track in a playlist is the one that's currently playing? %isplaying% and %list_index% don't seem to work. They are returned as a question mark for every track.

P.S.: Here's a list of all fields and methods of the COM object I found so far (PHP syntax, sub-objects are bold):

$Application->Name
$Application->ApplicationPath
$Application->ProfilePath
$Application->Minimized
$Application->Playback
$Application->Playlists
$Application->MediaLibrary

$Application->Playback->IsPlaying
$Application->Playback->IsPaused
$Application->Playback->Length
$Application->Playback->CanSeek
$Application->Playback->Position
$Application->Playback->Settings
$Application->Playback->Replaygain
$Application->Playback->Play($bPaused)
$Application->Playback->Stop()
$Application->Playback->Pause()
$Application->Playback->Next()
$Application->Playback->Previous()
$Application->Playback->Random()
$Application->Playback->Seek($dSecondsFromStart)
$Application->Playback->SeekRelative($dSecondsFromCurrentPosition)
$Application->Playback->FormatTitle($strFormat)
$Application->Playback->FormatTitleEx($strFormat, $lDisplayLevel)

$Application->Playback->Settings->Volume
$Application->Playback->Settings->PlaybackFollowsCursor
$Application->Playback->Settings->CursorFollowsPlayback
$Application->Playback->Settings->StopAfterCurrent
$Application->Playback->Settings->ActivePlaybackOrder
$Application->Playback->Settings->PlaybackOrders

$Application->Playback->Settings->PlaybackOrders->Count
$Application->Playback->Settings->PlaybackOrders->GuidFromName($strName)
$Application->Playback->Settings->PlaybackOrders->NameFromGuid($strGuid)

$Application->Playback->Replaygain->Mode
$Application->Playback->Replaygain->ApplyGain
$Application->Playback->Replaygain->PreventClipping
$Application->Playback->Replaygain->PreampWithRGInfo
$Application->Playback->Replaygain->PreampWithoutRGInfo

$Application->Playlists->Count
$Application->Playlists->ActivePlaylist
$Application->Playlists->Add($strName, $bActivate)
$Application->Playlists->Remove(&$oPlaylist)
$Application->Playlists->Move(&$oPlaylist, $lPosition, $oReferencePlaylist)
$Application->Playlists->Load($strName, $strFilename, $bActivate)
$Application->Playlists->Save(&$oPlaylist, $strFilename)
$Application->Playlists->GetTracks($strQuery)
$Application->Playlists->GetSortedTracks($strSortFormat, $strQuery)

$Application->Playlists->ActivePlaylist->Name
$Application->Playlists->ActivePlaylist->Index
$Application->Playlists->ActivePlaylist->GetTracks($strQuery)
$Application->Playlists->ActivePlaylist->GetSortedTracks($strSortFormat, $strQuery)
$Application->Playlists->ActivePlaylist->DoDefaultAction($lItemIndex)

$Application->MediaLibrary->Rescan()
$Application->MediaLibrary->GetTracks($strQuery)
$Application->MediaLibrary->GetSortedTracks($strSortFormat, $strQuery)

COM Automation Server for 0.9

Reply #120
Is it possible to know if a certain track in a playlist is the one that's currently playing? %isplaying% and %list_index% don't seem to work. They are returned as a question mark for every track.
No, that isn't possible.

P.S.: Here's a list of all fields and methods of the COM object I found so far (PHP syntax, sub-objects are bold):

...snip...
All of that information can also be found in the foobar2000.idl file that comes with foo_comserver2. If I remember correctly, you have to install the development files. Of course it is not in Python syntax.

COM Automation Server for 0.9

Reply #121
Fantastic plugin -- looks like just what I need.

I'm using VBA (Visual Basic for Applications), and having trouble understanding how to get playlist save to work.

I see that the command format is:
foo.playlists.save(oPlaylist as Playlist07, strFilename as string)

What structure do I need to use for oPlaylist?

Thanks!

COM Automation Server for 0.9

Reply #122
You can retrieve a playlist object from the playlists collection.

COM Automation Server for 0.9

Reply #123
You can retrieve a playlist object from the playlists collection.


Are there any examples of how to do this?  I'm trying to save the activeplaylist as an M3U file, and just can't figure it out...

Thanks,
John

COM Automation Server for 0.9

Reply #124
Just a small question:
Are the methods  playlists.load and playlists.save implemented?
I'am getting "NOT IMPLEMENTED" return code on these functions.

Thanks
Tommy


You can retrieve a playlist object from the playlists collection.


Are there any examples of how to do this?  I'm trying to save the activeplaylist as an M3U file, and just can't figure it out...

Thanks,
John