HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: foosion on 2006-07-25 12:02:18

Title: Run Command
Post by: foosion on 2006-07-25 12:02:18
foo_runcmd is a component that allows the user to search and invoke arbitrary menu commands. Menu commands can be invoked through command line options or a graphical user interface.

The component can be downloaded from my components page (http://foosion.foobar2000.org/0.9/), which also contains preliminary usage instructions (http://foosion.foobar2000.org/0.9/#runcmd).
Title: Re: Run Command
Post by: Zimdgre on 2006-07-25 13:17:08
Great, it works, thanks foosion.
Title: Re: Run Command
Post by: Strictly4me on 2006-07-25 13:22:01
Thats great, thanks. I love you!     

((((( Strictly4me )))))

EDIT: Doesn't run on 0.9.2 
Title: Re: Run Command
Post by: Squeller on 2006-07-25 19:09:58
Many thanks. This is especially great for us remote control users, because we execute actions by starting "foobar.exe /command:" syntax. Replaygain setting wasn't available there...

A very welcome feature would be if you make a "copy command name" function available. When clicking on a command, it could appear in the text field above, then we could copy it...
Title: Re: Run Command
Post by: TrNSZ on 2006-07-26 20:49:34
[deleted]
Title: Re: Run Command
Post by: wraithdu on 2007-03-08 07:03:48
I'm having a strange problem.  I'm using beta 2 with foobar 0.9.4.2 to load a flac image after creation with REACT into a "rip" playlist.  The command works, but not if my "rip" playlist is the currently active (focused) playlist.  If foobar is not running, it will not work if "rip" was the last active playlist (ie foobar opens up with "rip" open).

It will work just fine as long as any other playlist is active/focused in the window.  I get the same problem if I run the command at a cmd prompt.  Simplified version -

Code: [Select]
"C:\path to foobar\foobar2000.exe" /runcmd-files="Edit Other/Add to Playlist/rip" "C:\path to flac\artist - album.flac"


I'm using PanelsUI and a SCPL playlist and the command is from foo_utils.  Any ideas or known bug?
Title: Re: Run Command
Post by: foosion on 2007-03-08 15:13:54
I haven't looked at in detail, but I guess the problem would be in foo_utils.
Title: Re: Run Command
Post by: foosion on 2007-03-16 20:30:24
The problem is caused by foo_utils. By default, it does not show the command for the active playlist. Since foo_runcmd uses the API for searching commands that is also used for displaying the regular popup menu, it also sees the command as unavailable. You can fix this by enabling "Show active playlist as target" in the foo_utils preferences (Tools > Playlist tools).
Title: Re: Run Command
Post by: wraithdu on 2007-03-17 04:51:26
Thanks so much for the update.  I haven't tested it fully yet (not on my desktop right now), but it looks like that was the issue judging from my laptop.  Cool
Title: Re: Run Command
Post by: ih8gates on 2007-03-23 21:01:57
Is there a way to have a run_command execute on each track change?
Title: Re: Run Command
Post by: Old Grouch on 2007-04-22 04:43:38
Question on usage:  I'm trying to create a routine to randomize a playlist, and then sort it by $num(%play_count%,2), which I have in the "Sort by..." window.  AIUI, the code would be:
Code: [Select]
foobar2000.exe /runcmd-edit/sort/randomize
foobar2000.exe /"runcmd-edit/sort/sort by..."

I'm having a problem with the command line opening additional instances of foobar that I've got to fix, but I tried this using the FILE->RUN COMMAND GUI and when I do the second statement the Sort by... window stays open, and I have to click OK to close it.  Is there a way around this?

Second question:  Once I've done the sort, I'd like to set track 1 (top of the list) as the next selection.  I looked through the docs, and although I found the "Add to playback queue" function, I can't figure out how to move the cursor to the top of the list and then select track 1. 

Any help will be greatly appreciated.
Title: Re: Run Command
Post by: Squeller on 2007-05-27 13:49:50
I use the latest foo_uie_tabs.

I have 3 tabs organized into columns ui layout: "Organize", "Time", "Info".

I'm accessing those with:

foobar2000.exe /runcmd="select tab/info"
foobar2000.exe /runcmd="select tab/time"

For whatever reason, switching to time tab does no more work. Nothing happens. Switching to "info" works. If I enter "t" into the runcmd gui, I see it's a valid command: "View/Tabbed Panel Stack mod/Select tab/Time". But even with this complete string, nothing happens.
I'm using the native command line (/command:"time") now...

Any ideas?
Title: Re: Run Command
Post by: foosion on 2007-05-28 17:40:44
For whatever reason, switching to time tab does no more work. Nothing happens. Switching to "info" works. If I enter "t" into the runcmd gui, I see it's a valid command: "View/Tabbed Panel Stack mod/Select tab/Time". But even with this complete string, nothing happens.
I'm using the native command line (/command:"time") now...

Any ideas?

I don't know what the problem is, but could you please check the console? If you try to execute a command from the command line, the component will log the request and what action it took there.


Some answers to older questions (sorry for the delay):
I'm having a problem with the command line opening additional instances of foobar that I've got to fix, but I tried this using the FILE->RUN COMMAND GUI and when I do the second statement the Sort by... window stays open, and I have to click OK to close it.  Is there a way around this?

It's on my to-do list.

Second question:  Once I've done the sort, I'd like to set track 1 (top of the list) as the next selection.  I looked through the docs, and although I found the "Add to playback queue" function, I can't figure out how to move the cursor to the top of the list and then select track 1.

This is not possible with this component.
Title: Re: Run Command
Post by: Squeller on 2007-05-29 08:07:01
I don't know what the problem is, but could you please check the console? If you try to execute a command from the command line, the component will log the request and what action it took there.
Thanks for your console hint. I don't know what I did wrong, everything works fine this morning.
Title: Re: Run Command
Post by: Maranatha on 2007-07-16 22:46:32
I am trying to use this component with PanelsUI and the new Album Art Browser (cwbowron). 

The reason is that in order to get the Album Art to show in his new component whenever you first start foobar, you have to use the Main Menu item of  View/Browse Library Album Art .

It was my thinking that I could use this foo_runcmd to automate the process for me. 

I've read the available docs on this component, and tried several combinations of strings, but without result.

The closest I've gotten without getting an error console window is this string:
Code: [Select]
"C:\Program Files\foobar20003\foobar2000.exe" /runcmd="View/Browse Library Album Art"

but it still doesn't do anything, just doesn't return an error is all......


(foobar20003 is my testing installation directory)

Anyone have any idea why the above string will not work?  Thanks!
Title: Re: Run Command
Post by: foosion on 2007-07-16 23:56:43
Is there any message on the console?
Title: Re: Run Command
Post by: Maranatha on 2007-07-17 00:42:36
Is there any message on the console?

No message, the console doesn't come up at all...  foo starts normally without any notification console popping up, however the Browse Library Album Art Command is not being performed..
Title: Re: Run Command
Post by: foosion on 2007-07-17 10:29:05
The console never pops up by itself, you have to show it manually using the View/Console command. You are thinking about error popups.
Title: Re: Run Command
Post by: hybridfan on 2007-07-17 11:06:47
I love this plugin, I have set it up to show the album's wiki page in Firefox
Title: Re: Run Command
Post by: Maranatha on 2007-07-17 11:21:16
The console never pops up by itself, you have to show it manually using the View/Console command. You are thinking about error popups.

Sorry 'bout that!

The console reports:

Startup time : 0:02.729920
Elapsed time: 0
runcmd: Resolving main menu command (delayed): View/Browse Library Album Art
Single command found, executing: View/Browse Library Album Art



So, I assume that from that report, the command is being executed?  But, with no apparent results....
Title: Re: Run Command
Post by: foosion on 2007-07-17 12:24:01
I love this plugin, I have set it up to show the album's wiki page in Firefox

I think you are confusing foo_runcmd with foo_run (http://www.hydrogenaudio.org/forums/index.php?showtopic=45223).

So, I assume that from that report, the command is being executed?  But, with no apparent results....

Yes, it is executed. I don't know why the command has no effect; you'll have to ask the author of the album art browser about that.
Title: Re: Run Command
Post by: Maranatha on 2007-07-17 12:25:57
So, I assume that from that report, the command is being executed?  But, with no apparent results....

Yes, it is executed. I don't know why the command has no effect; you'll have to ask the author of the album art browser about that.


Alright, many thanks for your time and help!
Title: Re: Run Command
Post by: foosion on 2007-08-16 19:36:01
foo_runcmd 1.0 beta 3

Changes in this version:
Title: Re: Run Command
Post by: Squeller on 2007-08-17 05:06:07
Thx. There's also a freedb tagger update?
Title: Re: Run Command
Post by: foosion on 2007-08-17 08:38:27
Thx. There's also a freedb tagger update?

It merely got a description for the "Get Tags From freedb" command.
Title: Re: Run Command
Post by: Squeller on 2008-01-24 14:05:25
Hi foosion, commands like:

Code: [Select]
C:\Programme\foobar2000\foobar2000.exe /runcmd="Preferences/Playback/DSP Manager"
C:\Programme\foobar2000\foobar2000.exe /runcmd="Playback/DSP/Settings"

don't work any more. (The 2nd command is provided by foo_menu_addons). No window popping up. Other commands like "playback/stop" work with your component. Is it possible it happened because I installed the VC9 runtime libraries?

TIA
Title: Re: Run Command
Post by: foosion on 2008-01-24 14:14:44
I really, really doubt that this is related to the VC9 runtime. What does the foobar2000 console say when you try to run these commands from the command line?
Title: Re: Run Command
Post by: Squeller on 2008-01-24 14:40:19
Ah, I regularly forget about the console.
Quote
runcmd: Resolving main menu command: Playback/DSP/Settings
No available command found
runcmd: Resolving main menu command: Preferences/Playback/DSP Manager
No available command found
Title: Re: Run Command
Post by: foosion on 2008-01-24 14:58:25
Perhaps I should have re-read what I wrote earlier in this thread:
  • Jump to preferences page. The main menu version of the Run Command dialog lists preferences pages in the form "Preferences/name of page". These are not real menu commands, they are only available in this dialog.

Is the first command a real main menu command?
Title: Re: Run Command
Post by: Squeller on 2008-01-24 16:06:46
OK, the preferences command was just a misleading example which I didn't use anyway. But the other command. Yes, the first command is in the main menu if you have foo_menu_addons installed. It worked before and I don't see a reason why your plugin now doesn't find it. The only change I see is the upgrade to the new vc++ redist.
Title: Re: Run Command
Post by: Squeller on 2008-01-25 17:03:44
Meanwhile I had my windows restarted: Problem is solved. 
Title: Re: Run Command
Post by: bhorrell on 2009-07-03 03:51:31
Is there anyway to add a directory of music to the current playlist using this plugin?
Like this:
foobar2000.exe /runcmd="File/Add Directory" "D:\Cat Power"


If not how are people adding music usign the command line?

Thanks,
Ben
Title: Re: Run Command
Post by: foosion on 2009-07-05 21:47:29
You cannot pass arguments to main menu commands from the command line.

If not how are people adding music usign the command line?

Code: [Select]
foobar2000.exe /add "D:\Cat Power"

Title: Re: Run Command
Post by: Barnes on 2010-03-27 14:04:41
Hi,

i just installed this plugin and i also want to use it activate the shpeck plugin for mildrop visualisations but it doesn't work.
Somehow the menu items the shpech plugin adds to the visualisations sub-menu aren't seen by the run command.
The title of the subitems is fairly long but maybe when you match on keywords it could work.

example of submenu items added to visualizations submenu
shpeck - stop
shpeck - start 'Milkdrop 2.0c / Milkdrop 2.0c'

maybe a command like /runcmd="v//start milkdrop" should use the keywords 'start' and 'milkdrop' to identify the submenu.
if that should work all menu items could be called in similair fashion.
Title: Re: Run Command
Post by: foosion on 2010-03-27 15:03:25
The component currently does not recognize dynamic submenus correctly. I have already added this in the source code, but need to find some time to prepare a proper release.
Title: Re: Run Command
Post by: Forfit on 2011-09-04 13:16:11
I try to change tab with:
foobar2000.exe /runcmd="View/Switch to playlist/Mp3"
but it not work
"View/Switch to playlist/Mp3" is in toolbar and not in menu.
do it have a via to select a tab with this component?
Title: Re: Run Command
Post by: TERIYAKI BUKKAKE on 2011-11-15 03:50:09
Could you add
"e.g. ReplayGain/Scan selection as albums (by tags)"
to
"ReplayGain/Scan selection as albums (by tags-EXIT)" means exit foobar2000,if finished scan
or
"/runcmd=Exit/ReplayGain/Scan selection as albums (by tags)"?

Right now I use foo_scheduler and input any time
How do you think?


Title: Re: Run Command
Post by: delusion on 2012-05-03 15:38:09
The component currently does not recognize dynamic submenus correctly. I have already added this in the source code, but need to find some time to prepare a proper release.


has this point changed in any way since 2010? because this sentence sounds like the answer of my question, why my DSP-Preset-runcmd is not working...

i try to access following DSP Preset: "C:\Program Files\foobar2000\foobar2000.exe /runcmd="Playback/DSP settings/Fade Off" without any luck!
it's accessible via keyboard shortcut, but not via foo_runcmd or foo_run ("C:\Program Files\foobar2000\foobar2000.exe /command:"Fade Off")

i need to switch DSP-Presets via commandline, because i use it in scheduler.
and it is not possible to use the built-in fade, because i use edcast-DSP, so volume control and fade do not work for the streaming-DSP.

is there any chance of help, for switching between dsp-presets?
or do i have to use the melomane's "workaround" http://www.hydrogenaudio.org/forums/index....showtopic=58898 (http://www.hydrogenaudio.org/forums/index.php?showtopic=58898)

thx in advance, greetz, dls
Title: Re: Run Command
Post by: rainforest1155 on 2014-08-23 16:47:55
I'm looking to create a batch file so I can run it via a shortcut to add the currently playing song to a preset playlist without having to manually do that. Run Command along with the playlist command component appear to be what I need. Here's what I have so far:
foobar2000 /runcmd-playing=Copy
foobar2000 /playlist-activate:"bookmark"
foobar2000 /runcmd-playlist=Paste
foobar2000 /playlist-activate#playing

The problem is that the third line to paste the copied song doesn't work. Looking into this more closely, I can't even find any "paste" command in the Foobar keyboard shortcut settings.
Am I missing something or doesn't Foobar include the required command?

I have version 1.3.3 .

I also tried to find a way to use the clipboard contents in a batch file (via nircmd) so I could run a "foobar /add" command for the file in question, but nircmd seems to only support the text content of the clipboard, which merely has the title and artist, but not the path to the song.

Any other suggestions to achieve what I'm looking for?

Thanks,
Sebastian
Title: Re: Run Command
Post by: foosion on 2014-08-23 17:44:20
You are right, there is no Paste command which can be used by foo_runcmd. However you can install foo_utils which has commands to add songs to another playlist (for example "Edit other/Add to Playlist/bookmark"). You can assign these commands to a keyboard shortcut in foobar2000 so there is no need for a batch file.
Title: Re: Run Command
Post by: rainforest1155 on 2014-08-31 17:00:41
You are right, there is no Paste command which can be used by foo_runcmd. However you can install foo_utils which has commands to add songs to another playlist (for example "Edit other/Add to Playlist/bookmark"). You can assign these commands to a keyboard shortcut in foobar2000 so there is no need for a batch file.

Great, thanks for the super fast reply and pointing me in the correct direction. Still need the batch file as I couldn't find a way to apply a shortcut to the currently playing song without having to manually focus it in the playlist that's currently playing. However in connection with run command, it basically just takes this command:
foobar2000.exe /runcmd-playing="Edit Other/Add to Playlist/bookmark"

For good measure, I also threw in this command:
foobar2000.exe /playlist-activate#playing
to focus the current playlist (as the add command doesn't seem to work if you're in a different playlist).

With autohotkey, I set up a global shortcut with the windows key and to avoid the batch console window from opening each time I use the shortcut, I'm using the Hidden Start tool.

Still needs some testing, but seems solid on first glance so I can now have a playlist running and bookmark any song without having to switch to foobar.
Title: Re: Run Command
Post by: foosion on 2014-08-31 23:19:33
... I couldn't find a way to apply a shortcut to the currently playing song without having to manually focus it in the playlist that's currently playing.
There is a "[context / now playing]" section on the keyboard shortcuts preferences page for this very purpose. It is the last root item in the action window after "[main]", "[context]" and "[context / playlist]", so it helps to collapse these items.
Title: Re: Run Command
Post by: rainforest1155 on 2014-09-01 10:05:39
There is a "[context / now playing]" section on the keyboard shortcuts preferences page for this very purpose. It is the last root item in the action window after "[main]", "[context]" and "[context / playlist]", so it helps to collapse these items.

That's super - works great! Collapsing all the items is really useful to see what's available. Thanks so much.
Title: Re: Run Command
Post by: addawd on 2014-10-02 19:39:20
Is there any way to change dsp chain presets with this plugin or change dsp chains when I change the playback order to "shuffle" etc some other way??
Title: Re: Run Command
Post by: WilB on 2014-10-03 11:55:57
I do not believe that this component can automatically run dsp chain preset commands in response to changing the playback order if I understand what you wish to do correctly.


You can automatically do it simply with wsh panel mod (http://www.hydrogenaud.io/forums/index.php?showtopic=70363) with something like the code below. You will need to enter your own DSP chain preset names.
Code: [Select]
// NEW: Called when playback order is changed
// new_order_index:
//      0 - "Default"
//      1 - "Repeat (Playlist)"
//      2 - "Repeat (Track)"
//      3 - "Random"
//      4 - "Shuffle (tracks)"
//      5 - "Shuffle (albums)"
//      6 - "Shuffle (folders)"
function on_playback_order_changed(new_order_index)
{
    if (new_order_index == 4)
{
        fb.trace("shuffle preset")
        fb.RunMainMenuCommand("Playback/DSP settings/YOUR PRESET NAME")
    }
    else
{
        fb.trace("other preset")
        fb.RunMainMenuCommand("Playback/DSP settings/DIFFERENT PRESET NAME")
    }
}
Title: Re: Run Command
Post by: foosion on 2014-10-03 14:38:55
DSP presets can already be changed using the menu or keyboard shorts cuts. While this component provides means to access menu commands interactively and via the command line, it does not provide automation or scripting features.
Title: Re: Run Command
Post by: fohrums on 2014-11-04 00:27:33
I'm trying to use foo_run for setting keyboard shortcuts to apply ratings with foo_quicktag but I don't know what the parameters are. Here's what doesn't work:

(keep in mind i'm using linux, hence the wine; as this is the only way to set global shortcuts)

Code: [Select]
wine "/home/jj/.wine/drive_c/Program Files (x86)/foobar2000/foobar2000.exe" /runcmd="1"

Code: [Select]
wine "/home/jj/.wine/drive_c/Program Files (x86)/foobar2000/foobar2000.exe" /runcmd="/1"

Code: [Select]
wine "/home/jj/.wine/drive_c/Program Files (x86)/foobar2000/foobar2000.exe" /runcmd="//1"

Code: [Select]
wine "/home/jj/.wine/drive_c/Program Files (x86)/foobar2000/foobar2000.exe" /runcmd="///1"


through Foobar2000's keyboard it's nested under:

[context] / Tagging / Quick Tagger / Set <Rating> to / 1

here's an image, from thsi I can't even tell what's the parameters to set a specific rating #
(http://s4.postimg.org/h5zmq8971/foobarkeyboard.jpg)

**UPDATE**
The proper way to find out the command parameters for foo_run is through "Right-Click Selection(s) > Run Command... Dialog Window" like so:
(http://s8.postimg.org/ijsn7opvp/foobarkeyboard2.jpg)
Title: Re: Run Command
Post by: foosion on 2014-11-04 12:15:59
Glad you solved it! You had me confused there for a minute because you mentioned foo_run which is a separate plugin. It allows the user to execute arbitrary commands on the command line from within foobar2000 so in a sense it is the inverse of foo_runcmd.

Note that context menu commands require the use of the /runcmd-playlist or /runcmd-playing command line switches. You can also check the foobar2000 console for information how the foo_runcmd plugin resolved your command name.
Title: Re: Run Command
Post by: Spanky Monkey on 2014-11-11 12:47:36
@ Foosion, great component, I am just having a problem getting replaygain scanning to work.

This is a batch script.
Code: [Select]
CD /d "C:\program files (x86)\foobar2000\"
start foobar2000.exe /command:"select all" /command:"select all" /command:"remove" /add "d:\desktop\audio" /runcmd-playlist="ReplayGain/Scan per-file track gain"


Fb2k opens, clears the current playlist, and populates the playlist but then sits there.  I have tried all sorts to invoke replaygain scanning, but it won't have it.  I did try firstly using "/context_command:" but that did nothing too.

Any idea what I am missing here?

Thanks
Title: Re: Run Command
Post by: Spanky Monkey on 2014-11-11 14:43:58
^ Update, I sorted it.  It's me not understand quite what I am doing with CLI and batch.  Your component works flawlessly.

The fix is to have each action on a separate line, with a delay/pause - trying to RG scan an unpopulated playlist just isn't going to happen, give it a little time.
Title: Re: Run Command
Post by: foosion on 2014-11-11 18:40:08
If you don't need the files in the playlist you could scan them directly, e.g.
Code: [Select]
start "C:\Program Files\foobar2000\foobar2000.exe" /runcmd-files="ReplayGain/Scan per-file track gain" "d:\desktop\audio"
Title: Re: Run Command
Post by: Spanky Monkey on 2014-11-14 02:28:30
If you don't need the files in the playlist you could scan them directly, e.g.
Code: [Select]
start "C:\Program Files\foobar2000\foobar2000.exe" /runcmd-files="ReplayGain/Scan per-file track gain" "d:\desktop\audio"

Ah, that is interesting thanks.  However this automatically seems to play the files, and if I add /command:stop, it seems to not scan them...hmm.

Something you might be able to help with, I don't know.  I am trying to get the RG scan to work on an XP Home machine.  It will not work, if it's from batch or from CLI.  Only the GUI seems to allow replaygain scanning.
Eventually the batch script will run on Win Server 2003, so I'd like to iron out the bugs.

Code: [Select]
:: Defines current directory as the fb2k install dir
cd /d "c:\program files\foobar2000\"

:: Executes fb2k (start to save having to exit fb2k for next task)
start foobar2000.exe

:: Clears current playlist
start foobar2000.exe /command:"select all" /command:remove

:: Populates playlist with folder
start foobar2000.exe /add "d:\desktop\audio files\"

:: This is a delay command of 3 seconds.
ping 1.0.0.0 -n 1 -w 3000 >NUL

:: Performs Replay Gain Scan on the playlist contents, using Track Gain.
foobar2000.exe /runcmd-playlist="replaygain/scan per-file track gain"

:: This is a delay command of 5 seconds.
:: Add more time for slow computers or many long files to complete Replay Gain scan.
ping 1.0.0.0 -n 1 -w 5000 >NUL

:: Performs conversion using processing preset.
foobar2000.exe /runcmd-playlist="convert/Processor"


It all sees to run fine, but for the replaygain scanning.  What happens is that the playlist gets a few added entries:
C:\program files\foobar2000\gain*
C:\program files\foobar2000\per-file
C:\program files\foobar2000\track

It looks like some quotes are missing or something, but there not...very odd behaviour.  It's not case sensitivity either, I have tried both ways.
If you can fathom this one, that would be grand.

Cheers
Title: Re: Run Command
Post by: foosion on 2014-11-14 22:16:34
I am no expert on batch scripts on Windows. Also I am on windows 8.1 and don't have a copy of Windows XP around for testing.

It all sees to run fine, but for the replaygain scanning.  What happens is that the playlist gets a few added entries:
...
Try to add the quotes around the whole argument, i.e.
Code: [Select]
start foobar2000.exe "/runcmd-playlist=d:\desktop\audio\"

By the way, the following variations of your script worked just fine for me, except that I used different paths for the audio files and the foobar2000 installation directory.
Code: [Select]
cd /d "c:\program files\foobar2000\"
start .\foobar2000.exe "/runcmd-files=replaygain/scan per-file track gain" "d:\desktop\audio\"

Code: [Select]
cd /d "c:\program files\foobar2000\"
start .\foobar2000.exe
.\foobar2000.exe "/runcmd=edit/clear"
.\foobar2000.exe /add "d:\desktop\audio\"
ping 1.0.0.0 -n 1 -w 3000 >NUL
.\foobar2000.exe "/runcmd-playlist=replaygain/scan per-file track gain"
Title: Re: Run Command
Post by: Spanky Monkey on 2014-11-15 21:52:11
Thanks for your input foosion.
I tried my original script under an XP Home SP3 VirtualMachine, and the only issue it had was the delay command (ping).  I can't name it list a number of tries and >NUL the result at the same time.
So simply:
Code: [Select]
ping 1.0.0.0 -w 3000 >NUL

But we are discussing MS-DOS batch syntax and differences, not your component, so I figure it's a topic for another forum.

Good point about running the full /runcmd... command, in full quotes, rather than just the action bit.  That seems to make /runcmd="edit/clear" work, as opposed to before it would not.

I'll take all this onboard and keep plugging away with the other XP machine.  I think it's safe to assume your component is fine, and it's something a miss somewhere either in the batch script or how the OS is interpreting the commands.
Thanks again for your help, much appreciated.
Title: Re: Run Command
Post by: fohrums on 2014-12-14 09:28:14
From my understanding foo_runcmd is ordered off via tree-list heirarchy e.g.

Is it possible to change or add an alias to Foobar2000's commands? This is because I think i'm having a problem with the syntax of certain commands like this one:

With the example above, notice the parameters (< > [ ]) and when executing along with it will return an error. Although the command works, I just don't want to be presented with an error every time. WIth that said, here is the way i'm running the command:
Code: [Select]
wine "/home/xxxx/.foobar2000/drive_c/Program Files/foobar2000/foobar2000.exe" /runcmd-playing="Tagging/Quick Tagger/Set <Rating> to/[Remove Field]"

otherwise I would want it to be said as

Tagging/Quick Tagger/Set/Remove
Title: Re: Run Command
Post by: foosion on 2014-12-14 16:44:18
The plugin assigns a both to each command based on the name of the command and its position in the menu hierarchy. When you want to run a command you need to specify a partial path which uniquely identifies the command. Partial path means that you can leave out components of the path or use a prefix of a component instead of the full component as long as the partial path fits to only one command.

Both of the following commands work here (Windows 8.1) without error.
Code: [Select]
foobar2000.exe /runcmd-playing="Quick Tagger/Set <Rating> to/[Remove Field]"
foobar2000.exe /runcmd-playing="Quick/Set <Rating>/[Remove"

What error message go you get? What does it say?

By the way, since you use wine you may want to put the quotation marks around the complete argument, e.g.
Code: [Select]
foobar2000.exe "/runcmd-playing=Quick Tagger/Set <Rating> to/[Remove Field]"
Title: Re: Run Command
Post by: Spanky Monkey on 2014-12-16 14:21:49
Hey foosion,
I found the reason why the script was throwing fits on XP - It was auto formatted quotes *face palm*.
I'd used Google Docs to pass the script over, and the quotes had been auto formatted, so it was broken.  All is well.

I am wondering about something though.

I appreciate that this is not really part of your component, but it does relate to it, as your component allows fb2k commands from batch scripts.
Is there a way to get fb2k to actually relay it's status back to cmd?

Say I load a really long bunch of files, it'll take some time. 
Now, I want to replaygain scan them, that will also take some time.
Then, I want to process the files, it'll take even longer.
Well, if fb2k doesn't return a 'finished' result back to cmd, then I would have started RG scanning before all the files are loaded, and would be processing files before all are RG scanned.

You can see, it's a recipe for everything not happening systematically and in order.

The basic outline of a batch script I have written:
Copy files from folder on network drive.
Copy the local copies to a working folder.
Loudness normalise with fb2k (replaygain + hard limiter)
Copy processed files back to network drive.

I have two specifically different folders for each day, which are copied and will be processed one after the other in one working folder.  This is why I need to know when fb2k has finished it's processing job.  I'll keep experimenting and see how it goes.

Cheers
Title: Re: Run Command
Post by: foosion on 2014-12-16 19:17:09
Even foo_runcmd cannot tell whether the command was success or when it is finished. The plugin only knows whether the command was executed or not but there is no way to communicate that back to the script. As it is foo_runcmd is mostly useful for manually triggering individual commands from outside foobar2000 but not for scripting.

It would be nice if foobar2000 could be automated that way but this would require major changes to foobar2000 itself and all plugins.
Title: Re: Run Command
Post by: Spanky Monkey on 2014-12-16 20:36:17
Even foo_runcmd cannot tell whether the command was success or when it is finished. The plugin only knows whether the command was executed or not but there is no way to communicate that back to the script. As it is foo_runcmd is mostly useful for manually triggering individual commands from outside foobar2000 but not for scripting.

It would be nice if foobar2000 could be automated that way but this would require major changes to foobar2000 itself and all plugins.

Thanks for the reply,
That's what I was afraid of.  Looks like some major time delays with 'TIMEOUT /nobreak /t x' to get the jobs done, and maybe I can count the number of files, or get some idea of the total playtime (from another program) and pipe that in and multiply it up for a guestimate ballpark timeout.

Thanks for all of your help with the component.  It's great and I haven't found any other tools to do what has to be done, quite as well as this.
All the best to you, and hope you have great festivities, whatever you do.
Title: Re: Run Command
Post by: fohrums on 2014-12-17 13:24:40
...What error message go you get? What does it say?...


I've posted more info on this error on superuser (http://Wine%20says%20“fixme:heap:HeapSetInformation”%20when%20trying%20to%20run%20command):

Code: [Select]
fixme:heap:HeapSetInformation (nil) 1 (nil) 0


I'm only thinking it's a syntax error, because it only happens with Quick Tagger commands.
Title: Re: Run Command
Post by: Skif_off on 2015-11-02 14:31:24
Help please: how i can run "Edit/Select all"?

Code: [Select]
foobar2000.exe /runcmd="Edit/Select all"
foobar2000.exe /runcmd-playing="Edit/Select all"
foobar2000.exe /command:"select all"

don't works.

foobar2000 v1.3.9 beta 5
Title: Re: Run Command
Post by: foosion on 2015-11-02 19:24:15
The "Select all" command is only enabled when the playlist view is focused. I guess this is the problem here. Note that the component outputs diagnostic messages to the foobar2000 console. You can open the console from the "View" menu.
Title: Re: Run Command
Post by: Skif_off on 2015-11-02 20:26:37
foosion
Big thanks, I will think.
Title: Re: Run Command
Post by: Issst on 2015-11-09 18:10:35
Hello!

How to make step by step this Service:
1) Set Rating 1
2) Playback/Next

What i need to write in "Tools/Run Service/Path"?

Thanks!
Title: Re: Run Command
Post by: marc2003 on 2015-11-09 18:41:08
it seems you're looking at the preferences for foo_run which is a completely different component for launching external programs/scripts from within foobar.

the docs for foo_runcmd are here...

http://foosion.foobar2000.org/components/?...amp;version=1.1 (http://foosion.foobar2000.org/components/?id=runcmd&version=1.1)
Title: Re: Run Command
Post by: Shadowray on 2016-04-05 16:34:12
Hei guys i need a little help from you.

I am trying to solve the problem of writing two rating tags ("rating" and "rating wmp") with one shortcut key using quick tagger at the same time and i am as far as here in Foo_run - the script starts and closes with no result.

cmd /c start "1" "C:\foobar2000\foobar2000.exe" "/playlist_command:Tagging\Quick Tagger\Set <rating> to\1" & ping 127.0.0.1 -n 1>nul & start "2" "C:\foobar2000\foobar2000.exe" "/playlist_command:Tagging\Quick Tagger\Set <rating wmp> to\51"

I understand my command line is false, but where do i get the correct command?

BR,

Ray
Title: Re: Run Command
Post by: foosion on 2016-04-05 19:16:15
The /playlist_command switch is built into foobar2000 and only uses the command name. It does not check the menu hierarchy. You should use the /runcmd-playlist command from foo_runcmd. You also need to make sure to use forward slashes instead of backslashes. Therefore the parameter should be "/runcmd-playlist=Tagging/Quick Tagger/Set <rating> to/1".
Title: Re: Run Command
Post by: sstavross on 2016-11-08 13:54:21
Hi!

How is the syntax for opening foobar in a certain playlist? I want to load files in diferent playlist. I tried

foobar2000.exe /runcmd="View/Switch to playlist" "playlist's name"

but it doesn't work...
Title: Re: Run Command
Post by: xsdaver on 2016-11-08 17:24:46
I'm trying to use this component to switch playback devices.  I can do it with a custom button in Foobar2000, but I want to do two things with one action so I'd like to execute them from a batch files.  When I run this command:

foobar2000.exe /runcmd="Playback/Device/ASIO : ASUS Xonar ASIO driver - my channel mapping"

I get this message in the console:

runcmd: Resolving main menu command: Playback/Device/ASIO : ASUS Xonar ASIO driver - my channel mapping
No available command found

As I said, this is available with a custom button, but I'd need two buttons to perform both actions and would like to have both actions happen as quickly as possible.  Any help would be appreciated.
Title: Re: Run Command
Post by: foosion on 2016-11-09 06:39:09
The component does not see any commands in the Playback/Devices submenu, probably because they are created dynamically. I will need to update the component.
Title: Re: Run Command
Post by: sstavross on 2016-11-09 07:46:06
Hi foosion!

What about my question two posts before? How is the syntax for opening foobar in a certain playlist? please write what is the correct syntax. I read the Documentation page, but it doesn't have an example of some correct syntaxes so to know what to write...
Title: Re: Run Command
Post by: marc2003 on 2016-11-09 10:11:11
Read the post directly above yours!! Do you think the playlists menu is the same for all foobar users.... or is generated dynamically?
Title: Re: Run Command
Post by: sstavross on 2016-11-09 11:47:20
I though that foosion was answering to the previous message because he was talking about Playback/Devices submenu and not playlist submenu. I don't know much about programming but I thought the playlist's menu is the same for all users. Why has this to be dynamically? The commands are certain.
Title: Re: Run Command
Post by: marc2003 on 2016-11-09 12:09:19
The commands are certain.

You couldn't even use a real playlist name in your example. And yet somehow, you think your playlist names are never changing and identical to everyone else's? They're pre-defined by foobar itself and you can't do anything about it?
Title: Re: Run Command
Post by: foosion on 2016-11-09 18:32:25
I though that foosion was answering to the previous message...
Indeed, I was. I must have missed your message. Sorry for that. Nevertheless this is the same underlying problem as with the devices menu. The available playlists and devices depend on the configuration and environment of the particular foobar2000 installation. The corresponding menus are therefore generated dynamically instead of being hard coded into foobar2000 or a component. The crux is that these dynamically generated commands have to be handled a little differently from the programming side.
Title: Re: Run Command
Post by: sstavross on 2016-11-09 21:54:54
Thank you very much for your nice answer! You are very kind!!
I'll be waiting for the updated version of your component , whenever you will have time!
Again ,thank you for your time my friend!
Title: Re: Run Command
Post by: aabrams on 2016-11-24 18:29:02
Is there a way to suppress confirmation message when running the following command:
foobar2000.exe /runcmd-files="Utilities/Rebuild MP3 Stream" c:\someFolder\*.*

getting a confirmation message.

also getting a different confirmation message on this command:
foobar2000.exe /runcmd-files="Convert/32mbps" c:\someFolder\*.*

those messages are part of the normal UI behavior. Is there a way to script those commands in a quiet mode to avoid interaction.
I do not want to confirm anything in the middle of the script.

Thanks

Title: Re: Run Command
Post by: laddie on 2017-03-23 21:57:34
I can't get the command prompt to run anything under "Sort" in the Edit menu -- I want to set Foobar to run the randomize command and it doesn't actually do what it's supposed to...

foobar2000.exe /runcmd="Edit/Sort/Randomize"

v1.3.14

In console, this is the error I get:
runcmd: Resolving main menu command: Edit/Sort/Randomize
No available command found

Any ideas?
Title: Re: Run Command
Post by: sho on 2017-10-01 15:05:27
I can't get the command prompt to run anything under "Sort" in the Edit menu -- I want to set Foobar to run the randomize command and it doesn't actually do what it's supposed to...

foobar2000.exe /runcmd="Edit/Sort/Randomize"

v1.3.14

In console, this is the error I get:
runcmd: Resolving main menu command: Edit/Sort/Randomize
No available command found

Any ideas?
I'm trying a similar thing - reverse a playlist. I thought foobar2000.exe /runcmd="Edit/Sort/Reverse" would do the job, but it doesn't work. Same error as yours...
This command is not dynamically generated, but I still don't know why it doesn't work.
Title: Re: Run Command
Post by: piscvau on 2018-03-11 17:43:13
Hello,
we are using Foobar2000 v1.3.17on LINUX  under wine with foobar2000.exe /runcmd="view/swith to playlist/ name of playlist" /runcmd="Playback/play".
other commands work in the same environment (

The goal is to start playing always the same file (a web radio) when foobar is turned on.

We assigned these commands to keyboard shortcut and it works.
Thank you for your help.
Title: Re: Run Command
Post by: seriousstas on 2018-04-19 21:32:15
Please HELP:
"/runcmd=View/Visualisations/Analog VU Meter skins/<Default>/Next skin"
don't work (
Title: Re: Run Command
Post by: BenniP on 2019-09-08 16:29:30
Hi,

I'm out of ideas, I'd like to control the playback of foobar through the parameter /rundcmd.
But when I execute:
Code: [Select]
foobar2000.exe /runcmd="Playback/Play or Pause"
I receive the error:
Code: [Select]
Unknown commandline parameter: /rundcmd=Playback/Play or Pause

Am I doing something wrong here? (Obviously, but what :D)
Could someone help me out?

Thanks!


--BenniP
Title: Re: Run Command
Post by: anamorphic on 2019-09-09 13:23:01
I'm out of ideas, I'd like to control the playback of foobar through the parameter /rundcmd.
I receive the error:
Code: [Select]
Unknown commandline parameter: /rundcmd=Playback/Play or Pause
Firstly you have a typo in there ...

However why not try the built-in command line (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Commandline_Guide) options?

Code: [Select]
foobar2000.exe /command:"Play or pause"

Cheers
Title: Re: Run Command
Post by: BenniP on 2019-09-11 18:03:41
Thank you very much, didn't see that!
How stupid of me  >:(

Yeah, after I posted that I realised that as well.
Title: Re: Run Command
Post by: marc2k3 on 2020-04-20 20:57:49
If anyone is interested, I've made a little variant of this which processes main menu commands only but it has full support for dynamically generated menu items so you can switch playlists, output devices, run all Edit commands etc.

https://hydrogenaud.io/index.php?topic=118824.msg982342#msg982342
Title: Re: Run Command
Post by: MojoBass on 2020-04-21 04:59:49
Wow, I was looking for this for quite some time! Thanks!
Title: Re: Run Command
Post by: deskoul on 2020-05-14 15:30:11
Code: [Select]
"c:\Program Files (x86)\foobar2000\foobar2000.exe" /runcmd-playlist="Tagging/Remove tags from file(s)" "d:\Temp\Test.flac"
"c:\Program Files (x86)\foobar2000\foobar2000.exe" /runcmd-playlist="Utilities/Remove embedded cuesheet(s)" "d:\Temp\Test.flac"

Error:
Spoiler (click to show/hide)

Don't working from console. But working from UI. Any ideas?
Title: Re: Run Command
Post by: Awesomeo on 2020-08-02 14:13:38
Is there any reason why sorting doesn't work at all, bar for keyboard shortcuts?

No matter what I try: foo_run_cmd, built-in foobar cmd capabilities, full playlist sorting via main menu, selection sorting via main menu, context sorting - none if it works.

This question has been asked already before to no asnwer:

I can't get the command prompt to run anything under "Sort" in the Edit menu -- I want to set Foobar to run the randomize command and it doesn't actually do what it's supposed to...

foobar2000.exe /runcmd="Edit/Sort/Randomize"

v1.3.14

In console, this is the error I get:
runcmd: Resolving main menu command: Edit/Sort/Randomize
No available command found

Any ideas?
I'm trying a similar thing - reverse a playlist. I thought foobar2000.exe /runcmd="Edit/Sort/Reverse" would do the job, but it doesn't work. Same error as yours...
This command is not dynamically generated, but I still don't know why it doesn't work.
Title: Re: Run Command
Post by: marc2k3 on 2020-08-02 15:06:09
It has been answered and alternatives have been posted. Read the last few pages again.

edit: please don't exclaim the Sort menu isn't dynamically generated. It is....

(https://i.imgur.com/6SuUNak.png)
Title: Re: Run Command
Post by: Awesomeo on 2020-08-02 21:46:05
It has been answered and alternatives have been posted. Read the last few pages again.

edit: please don't exclaim the Sort menu isn't dynamically generated. It is....
Thanks, I was looking for direct answer to those posts. Now it works perfectly (although to set up a scheduler like I wanted I'm using now four distinct plugins, foo_runcmd, foo_run_main, foo_run & foo_scheduler).
Title: Re: Run Command
Post by: Swi on 2021-12-03 21:48:06
After hacker(ing) hides item "remove from playback queue" item is completely lost. And command ı/runcmd-context, /runcmd-playlist, even with /runcmd-playingı /runcmd="remove from playback queue" not work. Help please.




Title: Re: Run Command
Post by: fatears on 2022-01-25 21:55:06
How can you tell foobar to exit after completion of a command?

Specifically, I ran
foobar2000.exe /runcmd-files=Convert/FLAC *.flac

this worked fine.  how do I tell foobar to exit?

Thanks
Title: Re: Run Command
Post by: Swi on 2022-03-08 16:43:37
Hello. And how set dsp preset over command line? /runcmd="playback/dsp settings/preset" do not working.
Title: Re: Run Command
Post by: marc2k3 on 2022-03-08 18:31:37
This component can't run presets because the menu items are dynamically generated on the fly as you create/remove them.

My component (foo_run_main) supports it.

Download: https://github.com/marc2k3/fb2k-component/releases
Readme: https://github.com/marc2k3/fb2k-component/blob/main/README.md#foo_run_main
Title: Re: Run Command
Post by: Swi on 2022-11-08 18:29:45
Hello. Can teach foo_runcmd read brackets "( )" in play path when opening a file? By command foobar2000.exe /runcmd-files=play "C:\(music)\file 1.mp3" file not opening.  :-[
Title: Re: Run Command
Post by: grimes on 2022-11-08 18:46:55
'(' is worth trying. "C:\'('music')'\file 1.mp3"
Title: Re: Run Command
Post by: Swi on 2022-11-08 19:22:54
So working. Thank. But wanted would without apostrophes.
Title: Re: Run Command
Post by: fooball on 2022-11-09 07:13:14
It's a bad idea to use unusual characters in file paths and file names.  When you ask a program to process a string such as "C:\(music)\file 1.mp3", first there are limitations in how the language used to write the program handles strings, and then there are limitations on how the operating system handles the string once it is passed through.

It is not unusual to have to "escape" special characters or whole strings to make sure they reach their destination intact, sometimes multiple times, for example enclosing a string in quotes if it contains a space so that the string is not interpreted as two separate strings.  One reason is that certain characters have special meanings.  " " is used to recognise that the end of a string has been reached.  "\" is interpreted as a separator in path strings.  "(" (when passed into Windows) is interpreted as continuing the command on the next line.

If you don't like

C:\'('music')'\file 1.mp3

...you might find this works:

'C:\(music)\file 1.mp3'

...but you would be better off not using "(music)" as your folder name in the first place.
Title: Re: Run Command
Post by: fabiospark on 2022-12-09 22:48:48
Is there a way to create a new playlist querying one of the filtering device?
For instance: Quicksearch  artist HAS Miles

And one to select a plylist and then start the playback from that playlist?

Thank you.
Title: Re: Run Command
Post by: arabeh on 2022-12-31 12:50:37
Hi,
Is there similar component for 64 bit fb2k?

edit:
I'm trying to run "File Operations" command on selected playlist items though through command line
Code: [Select]
foobar2000 "/playlist_command:<File Operations/Move to/preset_name>" 
  this doesn't work
Title: Re: Run Command
Post by: xsdaver on 2023-11-21 14:58:43
Is there any chance that a version of this that is compatible with x64 Foobar will be available?  Or something else that will do the same thing?

Edit:  Nevermind...