Play music albums when their folders are double-clicked

I don't have m3u files in each folder and instead I would like to launch an external program with the folder path as an argument. But it seems that my syntax is wrong.

Example...

DOpus.NewCommand.RunCommand "C:\MyApps\Scripts\PlayAll.exe"  """" & doubleClickData.tab.Path

What is the right syntax to launch an external command in the script?

Thanks

The quotes in that make the line invalid VBScript syntax before Opus is involved at all.

Please link your account and start a thread in Help & Support for detailed help with how to write VBScript.

Leo,

I made some progress as how to run an external command:

Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run( "C:\MyApps\Scripts\PlayAll.exe "  & """ doubleClickData.tab.Path & """, 0, false)

Is this the right syntax, because when I add those lines it navigates to the folder instead of launching the playall.exe file. I included the OnDoubleClick = True but it still navigates to the folder.

Thanks

Sorry for missing this when it was posted. I meant to reply and then it got buried in my to-do list.

In case you still need it, I think the quotes were slightly wrong. Try this:

Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run( """C:\MyApps\Scripts\PlayAll.exe"" """ & doubleClickData.tab.Path & """", 0, false)

I cannot seem to get the script to work my system is OPUS 11 Windows 8.1

My folder which I copy into the config window when I double click it just goes into the folder and does not play it.

C:\Users\Desmond\Music\New Music Library

Did you configure paths to each music folder? (i.e. C:\Users\Des\Music\New Library\ACDC\Back In Black etc.)

Does each album have a playlist? (i.e. C:\Users\Des\Music\New Library\ACDC\Back In Black\Back In Black - Playlist.m3u)

Are you in thumbnails mode?

Beyond this, I can't help...

Nice script. I have a suggestion: please add some threshold function which checks for the number of subfolders. Because, if i try to open a folder holding several subfolders (= the actual records), the script would add them all to a big playlist, which i usually don't want. So, for example, if we set foldertreshold=3, the script would not get active, if we enter a folder holding more than three folders, preventing to open a multitude of records.

v1.1 update:

The script now checks which mouse button and keys were held down. It will ignore double-clicks made using the middle button, or when Ctrl, Shift or Alt are held down.

This change requires Opus 11.16.1 (beta) or later, which was released today.

Hmm, the new version does not work here anymore. I can't set the path to foobar, as in the first version. Did i overlook something?

Which version of Opus are you using it with?

It's version 11.16.3, 64-bit.

Actually, re-reading what you wrote: I can't set the path to foobar, as in the first version. I misread and thought we were talking about setting the music folders, which is the only configuration option the script has.

You've never been able to set the path to Foobar or any music player. It's not needed. The script works by launching the .M3U playlist file as if it was double-clicked.

So you just need to make sure that M3U files are set to open with Foobar (or whichever music player you want).

Leo, sorry for the mistake. I didn't remember, that i use some modified version of your script, the one by jhn431. Since i don't have M3Us in all my folders, i chose to use that version. That explains the path to foobar2000, too.

Root post updated with new version of the script:

v1.2 (20-Jan-2016):

  • Now looks for both .m3u and .m3u8 files, to support Unicode playlists.

.m3u8 files are important as they let you name David Bowie's ★ album correctly. :slight_smile:

Nice...

R.I.P. David Bowie :cry:

i just tried this script, the one by jhn431. with musicbee works great

i just set the foobar2000 path to musicbee.exe instead and it worked and set musicbee to compact player .... heaven

ok one thing if i set musicbee.exe works fine but if i set to M:\MusicBee\MusicBee.exe /OpenCompactPlayer
/OpenCompactPlayer
is the Command line parameter for CompactPlayer wont work but if i run a shortcut with M:\MusicBee\MusicBee.exe /OpenCompactPlayer
/OpenCompactPlayer works fine.... i dont know how to fix script can anyone help thanks ....

can jhn431 script please be update to switch to details view if you holddown ctrl and click left mouse button so that the album click opens in details view for editing

Please don't bump the thread repeatedly. Bumps with no new content get deleted.

While people often will write complete custom scripts, and are even more likely to answer questions from anyone who wants help learning to write or modify their own scripts, but people have many things demanding their time & skills and no one is obligated to write & test custom scripts.

Asking a "how do I do X?" question in Help & Support or in Script & Plugin Development may get help from people not reading this thread, or people willing to help answer questions but who don't have time to write/test a whole custom script.

I've updated the script slightly to allow subdirectories of the provided root folder to be clicked on as well.

In my case, my music folder has a /Music/Artist/Artist - Year - Album structure so I needed to allow subdirectories to function as well.

To do this I updated the IsPathInVector function to:

Function IsPathInVector(fsu, path, vecFolders)

	IsPathInVector = False
	
	' Resolve aliases, libraries, etc. to their real/absolute paths.
	path = fsu.Resolve(path)

	Dim testPath
	Dim resolvedTestPath
	
	For Each testPath in vecFolders
            Set resolvedTestPath = fsu.Resolve(testPath)
		If fsu.ComparePath(path, resolvedTestPath) Or Len(Replace(path, resolvedTestPath, "", 1, 1, vbTextCompare)) > 0 Then
			IsPathInVector = True
			Exit Function
		End If
	Next

End Function
1 Like