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 3734 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
😮

Re: Run Main (foo_run_main)

Reply #11
1.0.4 is not available for foobar2000 2.0?
It is stopped at 1.0.2.


Re: Run Main (foo_run_main)

Reply #13
/select_item_and_play is not available for 1.0.2?


Re: Run Main (foo_run_main)

Reply #15
Why /select_item_and_play is only available for x32 and not for x64?
Do it have a technical limit?

Re: Run Main (foo_run_main)

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

Re: Run Main (foo_run_main)

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

Re: Run Main (foo_run_main)

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

Re: Run Main (foo_run_main)

Reply #19
Too bad that it can't rename the playlist.  I tried this:

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