Open multiple audio files in AIMP with the Enter key

Hello,

my default music player is AIMP. If I select multiple mp3 files for example and press Enter the process takes quite a long time to add all the files to AIMP. The Windows Explorer doesnt have this behaviour its way faster.
Also if I right click and chose 'open with AIMP' it works like it does with the Windows Explorer.
Can I somehow achieve the same thing with the Enter key?

Does AIMP have a command line interface for adding multiple files at once?

I had a quick look but the FAQ and forum seem to only be in Russian so I didn't get far.

This is from the manual

Usage
AIMP.exe <command> <parameter 1> <parameter 2> ... 
Tip 1. Some commands don’t have parameters
Tip 2. Parameter value should be enclosed in double quotes

List of supported commands
/ADD_PLAY - Add objects to a playlist and start playing.

“object” is a playlist, folder or file
Input parameters - the paths to objects


/BOOKMARK - Add files and / or folders to your bookmarks.

Input parameters - path to the files and / or folders


/DIR - Add folder(s) to the playlist.

Whether playing of added the files starts, depends on the player settings
Input parameters - path to folder


/FILE - Add file(s) to the playlist.

Whether playing of added the files starts, depends on the player settings
Input parameters - path to file


/INSERT - Add objects to the active playlist.

Whether playing of added the files starts, depends on the player settings
“object” is a playlist, folder or file
Input parameters - the path to objects

This command has the effect I want: "AIMP.exe" /ADD_PLAY {allfilepath}

So I guess the problem is that when I press enter AIMP.exe is executed for every marked file and if I rightclick and chose "open with aimp" or the custom command above AIMP is only executed once?

I know it's not maybe the thing you are looking for, but you might reconsider to use Foobar instead for quick playing?

Let me explain. AIMP2 and AIMP4 have excellent music library plus they support awesome skinning. You may do this as well with Foobar, though. If you have a nerve to configure it in that way. But, basic Foobar installation is just awesome for send-to-it-for-quick-playing, plus it can convert anything to just about everything. :slight_smile:

Note that this is only needed due to a peculiarity of how enter / double-click works. For any other hotkey, toolbar buttons, etc., you could just run a single-line command for this.

  • Under Settings > Customize Toolbars > Keys, create a New Lister Hotkey:

  • Set the Hotkey to use the enter key using the menu on the right of the field:

  • Click Advanced.

  • Change the Function drop-down to Script Function.

  • If needed, change the Script Type drop-down to JScript.

  • Paste in the script below. It should now look like this:

  • Edit the AIMP_Path line near the top of the script for the correct path to AIMP.exe. I just guessed where it was as I don't have it installed.

Here's the script. When the enter key is pushed, it will handle everything that isn't a music file normally. Anything that is a music file gets moved into a separate command which is sent to AIMP with all files at once.

"Music file" is decided based on the Music file type group, so you can add or remove things from that as needed and the script will automatically handle (or not handle) those file types.

// Double any backslashes in the path.
AIMP_Path = "C:\\Program Files\\AIMP\\AIMP.exe"
AIMP_Arguments = "/ADD_PLAY"

AIMP_Command = "\"" + AIMP_Path + "\" " + AIMP_Arguments

function OnClick(clickData)
{
	if (clickData.func.sourcetab.selected.count == 0)
	{
		return;
	}

	var cmdDefault = clickData.func.command;
	cmdDefault.deselect = false;

	var cmdMusic = DOpus.Create.Command;
	cmdMusic.SetSourceTab(clickData.func.sourcetab);
	cmdMusic.deselect = false;

	anyDefault = false;
	anyMusic = false;

	for (var eSel = new Enumerator(clickData.func.sourcetab.selected); !eSel.atEnd(); eSel.moveNext())
	{
		var item = eSel.item();
			
		if (IsInFileTypeGroup(item, "music"))
		{
			cmdDefault.RemoveFile(item);
			cmdMusic.AddFile(item);
			anyMusic = true;
		}
		else
		{
			anyDefault = true;
		}
	}

	if (anyDefault)
	{
		cmdDefault.RunCommand("FileType ACTION=dblclk");
	}

	if (anyMusic)
	{
		cmdMusic.RunCommand(AIMP_Command + " {allfilepath}");
	}
}

function IsInFileTypeGroup(item, groupName)
{
	groupName = String(groupName).toLowerCase();
	if (item.is_dir)
	{
		return false;
	}

	for (var i = 0; i < item.groups.count; ++i)
	{
		if (groupName === String(item.groups(i)).toLowerCase()
		||  groupName === String(item.groups(i).display_name).toLowerCase())
		{
			return true;
		}
	}

	return false;
}
2 Likes

Thank you very much, now it works great :blush:

1 Like

I just read this:

What's new in AIMP v4.13, build 1887?

Fixed: Player – an issue with opening multiple files from the Windows Explorer (you need to re-associate file types)

Does that fixes the problem you had? (Without needing the Opus' script.)

Yeah this new version should fix the OP's problem. The OP's problem was a known problem back in December so with this recent release, he/she should no longer need the script. Since it's working perfectly fine for me here.

@Rated_RR
I agree about foobar2000. However, at least in my setup, I prefer to use AIMP for quick plays and foobar2000 for my usual leisure relaxation plays. Whatever works for the OP though.

I've tried it in the newest build of AIMP and it still doesn't work (without Leo's script) for me in Opus (it does in Explorer). Perhaps some combination of settings under "File adding" is required (except option to append new files to current playlist, I don't want that)?

I've encountered this problem with Winamp originally in 2012 (and Leo had also provided a script): Opening multiple files problem - #7 by bytespiller

Here are some of the more technical explanations from there:

And perhaps this (but could be out of context here):

I can agree with bytespiller, the new AIMP version does not fix this.

That's odd. It works for me. This is my context menu for music items:

Play Files with AIMP:
"C:\Users\Owner\Programs\Misc\AIMP\AIMP.exe" /add_play {f}
Queue Files with AIMP:
"C:\Users\Owner\Programs\Misc\AIMP\AIMP.exe" /insert {f}

I can select multiple music files and right click on them and add them all to AIMP without problems. I also tested it with Double Click and it works out fine too. I have not tested it with Enter yet though because I have music files associated with VLC by default on Windows instead of AIMP (I generally have file managers handle the file associations rather than using Windows for certain file types).

Yes the context menu was working all the time, only the Enter key did not.

I did some more testing.
If I have everything at default and mp3 associated with AIMP. AIMP reopens for every track I selected, leaving me with only one track in my playlist (this also happens with other 3rd party file managers).
If I go to the file type manager and change the 'open' command to '...AIMP.exe' /ADD_PLAY it gets all tracks but it is way slower than doing it via the context menu. The speed difference may not be that significant if the files are on a local drive mine are on a network share though.