Some of you may have seen this mentioned in random comments across the forums but I thought I'd start a new thread for it.
The blurb from the readme...
Unlike the built in command line handler/foo_runcmd, this component has full support for dynamically generated menu commands meaning you can use `Edit` commands and switch playlists, change output devices etc.
To avoid ambiguity with common names that might appear more than once under different sub menus, you must supply the full path to the command. Examples:
foobar2000.exe /run_main:Edit/Sort/Randomize
foobar2000.exe /run_main:Library/Search
// use double quotes when command contains spaces
foobar2000.exe /run_main:"Playback/Device/Primary Sound Driver"
As of v0.0.2, there is a new /select_item option so you can select a track from the active playlist.
It means you can do something like this:
foobar2000.exe /run_main:"View/Switch to playlist/stranger in the alps"
foobar2000.exe /select_item:5
foobar2000.exe /play
https://github.com/marc2k3/fb2k-component#foo_run_main
https://github.com/marc2k3/fb2k-component/releases
Do it is possible to execute commands from context menu?
Um, why? That already exists in the player.
Are you saying these limitations no longer exist??
Unlike the built in command line handler/foo_runcmd, this component has full support for dynamically generated menu commands meaning you can use `Edit` commands and switch playlists, change output devices etc.
I don't know, actually.
Yesterday, I added /select_item and gave this example...
foobar2000.exe /select_item:5
foobar2000.exe /play
Soon after, I realised this only works if people have
Playback follows cursor enabled which was a lack of foresight on my part.
v0.0.3 released just now has
/select_item_and_play which works regardless of settings.
Also, valid numbers are now clamped so anything in excess of the playlist item count will result in the last track being selected.
https://github.com/marc2k3/fb2k-component/releases
v0.0.4 released just now takes an optional delay when using
/select_item_and_play.
https://github.com/marc2k3/fb2k-component#foo_run_main
It means commands like this can now work.
foobar2000.exe /add "d:\path\to\blah.mp3" /select_item_and_play:1:1500
The delay is in milliseconds and I found 1000 too low which I is why i used 1500 as an example. YMMV.
Not sure how to understand above discussion on context menu commands execution:
Is foo_run_main able to start context menu commands like ReplayGain/Scan per track gain? I tried but it didn't work (just to be sure I didn't make any stupid error...)
Background: I would like to execute two (or more) context menu commands with one shortcut or button.
This component is for main menu commands only.
You can look at the built in support for running context commands...
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Commandline_Guide
@Marc: great, that works :)
".\foobar2000.exe" /playlist_command:"ReplayGain/Scan per-file track gain"
😮
1.0.4 is not available for foobar2000 2.0?
It is stopped at 1.0.2.
0.0.4 is the last version for fb2k 1.5+ https://github.com/marc2k3/fb2k-archive/releases/tag/archive
1.0.2 is for fb2k 2.0
https://github.com/marc2k3/foo_run_main/releases
/select_item_and_play is not available for 1.0.2?
Correct. You can use the old version with 32bit fb2k 2.0 but not 64bit.
Why /select_item_and_play is only available for x32 and not for x64?
Do it have a technical limit?
With the new release for fb2k 2.0, I decided those commands were outside the scope of a component named "Run Main".
I may consider a new component for playing items by index from the main menu. Then it could be bound to keyboard shortcuts, buttons or ran from the command line.
Do it is possible to add a query command to get tags from command line?
F.e. to get current title in dos console from a batch file.
With the new release for fb2k 2.0, I decided those commands were outside the scope of a component named "Run Main".
I may consider a new component for playing items by index from the main menu. Then it could be bound to keyboard shortcuts, buttons or ran from the command line.
Hello, marc2k3. This is a great idea! Thank you for foobar2000 components! It will be very useful to be able to play the first (and also random) track from defined in the settings playlist using hotkeys. This is important both when awarding at official events, at gigs, and listening to a large amount of unfamiliar audio material, etc.
Too bad that it can't rename the playlist. I tried this:
.\foobar2000.exe "/command:New playlist" /run_main:"File/Rename playlist/Sofa Surfers" /add "C:\Audio\Sofa Surfers"
It just triggers rename dialog and I have to manually set up the name.