Skip to main content
Topic: Run Command (Read 52658 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Run Command

Reply #50
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"

Run Command

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

Run Command

Reply #52
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"

Run Command

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

Run Command

Reply #54
From my understanding foo_runcmd is ordered off via tree-list heirarchy e.g.
  • Playback/Play
  • Tagging/Quick Tagger/Set <Rating> to/5

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:
  • Tagging/Quick Tagger/Set <Rating> to/[Remove Field]

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

Run Command

Reply #55
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]"

Run Command

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

Run Command

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

Run Command

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

Run Command

Reply #59
...What error message go you get? What does it say?...


I've posted more info on this error on superuser:

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.

Run Command

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

Run Command

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

Run Command

Reply #62
foosion
Big thanks, I will think.

Run Command

Reply #63
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!

Run Command

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

Re: Run Command

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

Re: Run Command

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

Re: Run Command

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

Re: Run Command

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

Re: Run Command

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

Re: Run Command

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

Re: Run Command

Reply #71
Read the post directly above yours!! Do you think the playlists menu is the same for all foobar users.... or is generated dynamically?

Re: Run Command

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

Re: Run Command

Reply #73
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?

Re: Run Command

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

 
SimplePortal 1.0.0 RC1 © 2008-2019