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: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1 (Read 2322 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

This post follows from an issue reported in two posts in this thread. Investigation indicates that the cause is that the commandline addition of files appears to have become broken.

This error only manifests itself in portable mode; all is fine in a standard install. The "Add location..." menu item still works.

foobar2000 1.3.13 gives the following error: "Internal error - cannot access configuration folder"
foobar2000 1.3.14 beta 1 gives the following error: "Cannot start, another foobar2000 instance appears to be running with the same configuration data" - it isn't.

The commandline is being run in a  JScript panel. I have isolated a snippet of code that when put in a JScript panel will trigger the error in portable mode, but correctly add the location in a standard install. It seems as though its a bug in foobar2000, but if for some reason the code now has to be written differently please advise. The issue occurs with the only extra plugin being JScript panel.

I hope that you are able to fix it.

Code: [Select]
    var location = ""// A location path can be entered here; error occurs whether entry present or blank
    //var location = "C:\\Music\\Music\\Electronic\\Jean Michel Jarre\\Zoolook\\1984\\01 - Ethnicolor.mp3"
    var immediate = true;
    var fs = new ActiveXObject("Scripting.FileSystemObject");
    function run(c) {try {var WshShell = new ActiveXObject("WScript.Shell"); WshShell.Run(c); return true;} catch (e) {return false;}}
    var str = fs.GetFolder(fb.FoobarPath).ShortPath + "\\foobar2000.exe /" + (immediate ? "immediate /" : "") + "add " + "\"" + location + "\"";
    run(str);

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #1
While it looks like you've found an issue that needs fixing, how come you aren't using plman.AddLocations? That would bypass the command line entirely.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #2
plman.AddLocations causes the add location dialogue box to appear briefly on each track addition and to show for even longer with multi-track additions, at least on my pc, when adding youtube tracks, whereas the foobar2000 add locations box usually doesn't show at all. I and other users find this irritating. So the script only currently uses JScript plman.AddLocations when there is no alternative; e.g. if adding to a playlist that isn't currently active. Perhaps plman.AddLocations could be made more efficient? I also seem to remember when testing it a while ago that plman.AddLocations doesn't have an immediate add option, so files always seemed to be sorted by the pattern configured under "Preferences > Shell Integration", resulting in the wrong order in the playlist on occasions. But I guess that's fixable (apologies if my memory on this point is wrong).

It would be nice if the foobar2000 add locations box had a check box so that it did not show at all when adding files from the commandline, as it still sometimes flashes up.

If JScript plman.AddLocations is somehow working through foobar2000 add locations, then the flickering appearance issue with that would also be solved by the check box.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #3
Well this seems to be relevant...

Code: [Select]
		//! Set this flag to make the progress dialog not steal focus on creation.
op_flag_background = 1 << 1,
//! Set this flag to delay the progress dialog becoming visible, so it does not appear at all during short operations. Also implies op_flag_background effect.
op_flag_delay_ui = 1 << 2,

Currently, JScript Panel is using the op_flag_background flag. It looks like I can update this to use op_flag_delay_ui which may solve your issue. Or it may not. Parsing tracks on a remote server is obviously more time consuming.

I don't have Visual Studio installed right now so it'll be a few days.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #4
@marc2003: There's also appears to be a lack of "immediate" add with plman.AddLocations. I added this in an edit to my previous post, the result is that tracks can be added to playlist in wrong order. See previous post for more info.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #5
WilB: It seems to be the short path which is causing the problem. Try the following code:
Code: [Select]
    var str = "\"" + fb.FoobarPath + "\\foobar2000.exe\"" + (immediate ? " /immediate" : "") + " /add \"" + location + "\"";

marc2003: You could use op_flag_delay_ui to make plman.AddLocations behave like the "Add Locations" menu command. It seems you already discovered this while I was writing this post. ;)

@marc2003: There's also appears to be a lack of "immediate" add with plman.AddLocations. I added this in an edit to my previous post, the result is that tracks can be added to playlist in wrong order. See previous post for more info.
@marc2003: This would be addressed by using op_flag_no_filter.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #6
^Thanks. I must admit, I wasn't aware of the shell integration settings kicking in to sort files. I only tested a few files/http urls and I've never used that function in any of my own scripts.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #7
@foosion: Thanks for the code snippet. So far its been working fine

@marc2003: I look forward to trying the updated plman.AddLocations

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #8
By the way, this can be reproduced entirely from the command line, using either absolute or relative paths. Here is a minimal example:
  • Execute ".\foobar2000\foobar2000.exe" to start foobar2000.
  • Execute ".\foobar~1\foobar2000.exe".
  • The application complains that another instance is already using the configuration data.
This also works the other way around. Close foobar2000 again before following these steps:
  • Execute ".\foobar~1\foobar2000.exe" to start foobar2000.
  • Execute ".\foobar2000\foobar2000.exe".
  • The application complains that another instance is already using the configuration data.
Using the long or short name of the .exe has no effect on the outcome.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #9
I doubt you'd ever need to use ShortPath when launching foobar. The only time I ever had to use it in my scripts was passing parameters like a database path and .sql file to sqlite3.exe and it used to choke on folders with Cyrillic characters in. Using ShortPath fixed that particular problem.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #10
For those of us not comfortable with all the computer innards talk, I am experiencing the access folder problem.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #11
I'm pretty sure the problem discussed in the thread has been fixed long ago. At least I can't trigger it. If you are facing a problem it would help to give some details.

Edit: my mistake, it isn't fixed. Still curious how you run into the problem, perhaps there is a way to workaround it if people know what you are doing.

 

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #12
Notice that he's using the ".ShortPath" operator on the full executable path, minus the executable name.

Re: Commandline not working in portable mode: foobar2000 1.3.13 & 1.3.14 beta 1

Reply #13
Well there was never any reason to use ShortPath in the original script. Just wrapping the path in double quotes to account for any spaces would have done...

Code: [Select]
"\"" + fb.FoobarPath + "foobar2000.exe\""

or

Code: [Select]
'"' + fb.FoobarPath + 'foobar2000.exe"'

And I believe my component fixes now bypass the need for the command line shenanigans completely.

Obviously bols59 will need to expand on whatever issue they're having???