HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: foorious on 2009-06-27 19:28:19

Title: foobar commandline control and dockable panels
Post by: foorious on 2009-06-27 19:28:19
Like Canar said in another topic :

The best-easiest way to control foobar2000 externally is using the commandline. foobar2000.exe /play and whatnot work without configuring keyboard shortcuts and are guaranteed to work regardless of what shortcuts any particular user has set up.

In that case, could somebody give me the right commandline syntax for executing these two actions ?
- View menu > Dockable Panels > Activate > (name of the panel we wish to activate)
- View menu > Dockable Panels > Collapse > (name of the panel we wish to collapse)

Right now I can assigh these two actions to convenient shortcuts and use them within an external AutoHotKey script. But I'd be happy to use the commandline instead if that's the "best-easiest way" to do it.

Thanks for your help.
Title: foobar commandline control and dockable panels
Post by: fbuser on 2009-06-27 20:46:16
Without further testing, foo_runcmd (http://foosion.foobar2000.org/components/?id=runcmd&version=1.0+beta+3) may help you here.
Title: foobar commandline control and dockable panels
Post by: foorious on 2009-06-28 21:15:36
Thanks, I didn't know an additional component was needed here.

I simply don't understand why this would be "better-easier" than my actual script that works... any ideas ?
Title: foobar commandline control and dockable panels
Post by: smkk on 2009-06-28 21:39:20
You don't need a plugin for this. The forum search on top of every page of the forum happily provides you more information about foobar's commandline.

http://www.google.com/custom?domains=hydro...D%3A1&hl=en (http://www.google.com/custom?domains=hydrogenaudio.org&q=foobar+commandline&sa=Google+Search&sitesearch=hydrogenaudio.org&client=pub-4544327213918729&forid=1&channel=7051718642&ie=ISO-8859-1&oe=ISO-8859-1&flav=0000&sig=6_g3ghDcS6bRpfcd&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3AFFFFFF%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BLH%3A50%3BLW%3A262%3BL%3Ahttp%3A%2F%2Fwww.hydrogenaudio.org%2Fforums%2Flogo50.png%3BS%3Ahttp%3A%2F%2Fwww.hydrogenaudio.org%3BFORID%3A1&hl=en)
Title: foobar commandline control and dockable panels
Post by: fbuser on 2009-06-28 22:21:55
He needs a plugin. From the wiki:

Quote
Please Note: All of the above works for 0.8.3, but /command: and /playlist_command: doesn't seem to be functional with the 0.9.x version. To work around this problem, try using the hotkey mechanism as listed here:


Following the link which is provided by the wiki:http://www.hydrogenaudio.org/forums/index....st&p=493883 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55004&view=findpost&p=493883)
Title: foobar commandline control and dockable panels
Post by: Yirkha on 2009-06-29 10:41:40
The wiki is severely outdated. The best way to get current info is to invoke [font= "Courier New"]foobar2000.exe /?[/font]

For example [font= "Courier New"]foobar2000.exe "/playing_command:Tagging/Get Tags From freedb"[/font] works fine with the default installation of the latest version. What doesn't work are items which are dynamically created, e.g. converter presets - then foo_runcmd comes into play.
Title: foobar commandline control and dockable panels
Post by: foorious on 2009-06-29 12:08:53
So I don't need a plugin. Great.

I have invoked "foobar2000.exe /?" inside XP's cmd prompt :

Code: [Select]
Available switches:
  /add <list-of-files> - appends the specified files to the current playlist instead of replacing the playlist content and playing them immediately
  /immediate - bypasses the "please wait" dialog when adding files
  /play, /pause, /playpause, /prev, /next, /rand, /stop - playback controls
  /exit - exits foobar2000
  /show, /hide - shows or hides the main foobar2000 window
  /config - opens the Preferences dialog
  /command:<menu command> - invokes the specified main menu command
  /playlist_command:<context menu command> - invokes the specified context menu command on current playlist selection
  /playing_command:<context menu command> - invokes the specified context menu command on currently played track
  /context_command:<context menu command> <files> - invokes the specified context menu command on the specified files

I'm going to try to deal with this... For example, would this command be correct ?

Code: [Select]
foobar2000.exe /command:View/Dockable Panels/Activate/1 - Peakmeter Spectrum

However, even if it's correct, I think we'll have a problem anyway. Because in the Dockable Panels' "Activate" menu, all panels have a distinctive number (e.g. "1 - Peakmeter Spectrum"). But in the "Collapse" menu, there are no distinctive numbers ! So if we have two Peakmeter Spectrum panels, they will all be named "Peakmeter Spectrum". So how can we differentiate them from the commandline ? 
Title: foobar commandline control and dockable panels
Post by: Yirkha on 2009-06-29 12:32:43
As foosion said in his linked post, "foobar2000 0.9 /command:x does not parse path information and just tries to match x against the name of a main menu item.". Therefore it would be just:
[font= "Courier New"]foobar2000.exe "/command:Columns Playlist"[/font] for "View menu > Dockable Panels > Collapse > Columns Playlist".
[font= "Courier New"]foobar2000.exe "/command:1 - Columns Playlist"[/font] for "View menu > Dockable Panels > Activate > 1 - Columns Playlist".
Title: foobar commandline control and dockable panels
Post by: fbuser on 2009-06-29 12:37:11
So if we have two Peakmeter Spectrum panels, they will all be named "Peakmeter Spectrum". So how can we differentiate them from the commandline ? 
Go to "View -> Dockable Panels -> Active Panel -> Custom Title ..." and change the titles to your needs.
Title: foobar commandline control and dockable panels
Post by: foorious on 2009-06-29 15:43:40
Thanks to both of you.

Yirkha, your commands work as expected (and much better than the same thing done via foobar shortcuts ! Yay !  ). fbuser, I hadn't noticed that panel titles could be changed.

One small problem remains : at foobar's startup, some panels keep appearing in the foreground when they shouldn't. I have tried forcing them to close upon foobar startup with the following AutoHotKey command :

Code: [Select]
Run C:\Program Files\foobar2000\foobar2000.exe "/command:Panelname1" "/command:Panelname2" "/command:Panelname3"

However, this doesn't work ! foobar keeps starting with some panels in the foreground.

Once foobar is completely started, everything works as expected (including the above command if I execute it via AutoHotKey), so it seems to be a startup problem.

So, is there a way to really force foobar to start up with ALL existing panels collapsed ?...
Title: foobar commandline control and dockable panels
Post by: Yirkha on 2009-07-02 14:57:14
Moderation: Subsequent debate about CUI panels in DUI, design choices and other things moved here (http://www.hydrogenaudio.org/forums/index.php?showtopic=73144).