Run Command (foo_runcmd) 1.1
Finds and executes menu commands.
Main menu commands can be executed through a graphical user interface that can be invoked through the "File/Run Command" main menu command, or via the command line like this:
foobar2000.exe /runcmd=<pattern>
where <pattern> should be replaced with a pattern describing the command (see below). In both cases, the given pattern must unambiguously match a command, otherwise no command will be executed.
Context menu commands can be run via the command line using one of the following parameters:
foobar2000.exe /runcmd-files=<pattern> <list of files> foobar2000.exe /runcmd-playlist=<pattern> foobar2000.exe /runcmd-playing=<pattern>
Command patterns
A command patterns is a non-empty sequence of characters that is used to filter the list of available commands based on their path. The path of a command consists of two parts: the menu a command appears in and the name of the command. If a command is located at the top level, its path is just the name. Path components are separated using a "/" character (forward slash).
Examples:
- The path of the "Play" main menu command in the "Playback" menu is "Playback/Play".
- The path of the "Reverse" main menu command in the "Sort" submenu of the "Edit" menu is "Edit/Sort/Reverse".
- The path of the "Properties" context menu command is just "Properties" since it is located on the top level.
To compare a pattern and a path, both the pattern and the path are split into components at "/" characters, even if the "/" characters is part of a menu or command name. A pattern is said to match a path, if the following conditions hold:
- The last component of the pattern is equal to or a prefix of the last component of the path. Character case is ignored.
- If the pattern has more than one component, the pattern excluding the last component matches a prefix of the path that excludes the last component of the path.
Normally, a pattern is used to filter a list commands. In that case, the results are further restricted by removing all matches except those with the highest number of equal components.
Examples:
- The pattern "Play" matches the main menu commands "Playback/Play", "Playback/Play or Pause", and "Playback/Playback Follows Cursor". It does not match "Playback/Stop", because there is no match in the last component, i.e. "Play" is not equal to or a prefix of "Stop", even though it is a prefix of "Playback". When filtering the list of matching commands, only "Playback/Play" is returned, because it is the only command with an exactly matching component.
- The pattern "v/" matches all main menu commands from the "View" menu and its submenus. Since there is no exact match, all commands are returned.
- The pattern "v//" matches all main menu commands from submenus of the "View" menu. It does not match any commands in the "View" menu itself.
Known problems and restrictions
The "Context Menu/Now Playing" and "Context Menu/Playlist Selection" do not react to changes in the playing song respectively the playlist selection while they are open.