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: Run Main (foo_run_main) (Read 1294 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Run Main (foo_run_main)

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...
Quote
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:

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

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

Re: Run Main (foo_run_main)

Reply #1
Do it is possible to execute commands from context menu?

Re: Run Main (foo_run_main)

Reply #2
Um, why? That already exists in the player.

Re: Run Main (foo_run_main)

Reply #3
Are you saying these limitations no longer exist??

Quote
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.

Re: Run Main (foo_run_main)

Reply #4
I don't know, actually.

Re: Run Main (foo_run_main)

Reply #5
Yesterday, I added /select_item and gave this example...

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


Re: Run Main (foo_run_main)

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

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


Re: Run Main (foo_run_main)

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


Re: Run Main (foo_run_main)

Reply #9
@Marc: great, that works  :)
Code: [Select]
".\foobar2000.exe" /playlist_command:"ReplayGain/Scan per-file track gain"

 

Re: Run Main (foo_run_main)

Reply #10
😮