This script makes it so you can double-click music albums to listen to them.
Here’s a short video showing what the script does and how it is configured. (The video is narrated, with optional subtitles.)
The script works by changing what double-click does when in thumbnails mode for specific folders (which you can configure).
To play the album, the script searches the for an .m3u playlist within the folder you double-clicked.
Since this only affects thumbnails mode, the script can be left enabled and your album folders can still be entered and managed in details mode.
Double-clicks will enter folders normally if you are not in thumbnails mode, or if you are not in one of the configured folders, or if no playlist is found within the folder you double-click.
If you had the original v1.0 installed:
[ul][li]Type /dopusdata/Script AddIns into the location bar.[/li]
[li]You may need to reconfigure the script once after installing the new version.[/li][/ul]
Installing new versions:
[ul][li]Download v1.2 (requires Opus 11.17 or above):
AlbumDoubleClick.vbs.txt (3.39 KB)[/li]
[li]Open Settings > Preferences / Toolbars / Scripts.[/li]
[li]Drag AlbumDoubleClick.vbs.txt to the list of scripts.[/li][/ul]
Once installed, select the script in Preferences and click the Configure button. You’ll see a list of script settings, although there is only one called AlbumFolders for this script.
Double-click the AlbumFolders line to edit that setting. By default, it’s set to these two folders:
Those are the folders where the script will change what double-click does. You can add or remove folders from the list as you wish. As you can see from the defaults, using aliases like /profile is allowed.
Click OK in both dialogs, and don’t forget to click OK or Apply in the main Preferences dialog (your script config changes won’t be saved until you do that).
[ul][li]Now looks for both .m3u and .m3u8 files, to support Unicode playlists.[/li][/ul]
[ul][li]Script will no longer affect middle-mouse double-clicks and double-clicks while holding Shift, Ctrl or Alt.
(Change requires Opus 11.16.1 or above.)[/li][/ul]
[li]The script itself:
If you just want to use the script, the AlbumDoubleClick.vbs.txt download above is probably easier.
The script code is reproduced here to make it easier for people browsing the forum for scripting techniques.
’ Album Double-Click
’ © 2014-2016 Leo Davidson
’ This is a script for Directory Opus.
’ See http://www.gpsoft.com.au/redirect.asp?page=scripts for development information.
’ This script makes it so double-clicking a music album folder thumbnail will play the album
’ instead of entering the folder.
’ It works by changing what double-click does when in thumbnails mode for specific folders
’ (which you can configure). To play the album, it searches the for an .m3u playlist within
’ the folder you double-clicked.
’ Since this only affects thumbnails mode, the script can be left enabled and your album
’ folders can still be managed in details mode normally, while Opus turns into a music
’ selection UI when you switch to thumbnails mode in the chosen folders.
’ Called by Directory Opus to initialize the script
’ Provide basic information about the Script
initData.name = "Album Double-Click"
initData.version = "1.2"
initData.desc = "Double-click music album thumbnails to play them"
initData.copyright = "© 2014-2016 Leo Davidson"
initData.default_enable = true
Dim vecDefFolders Set vecDefFolders = DOpus.NewVector ' Default folders / example config. vecDefFolders.push_back("/profile\Music") vecDefFolders.push_back("D:\Audio\Music Albums") initData.config.AlbumFolders = vecDefFolders initData.config_desc = DOpus.Create.Map("AlbumFolders", "List of folders the script should affect.")
’ Helper Function
Function IsPathInVector(fsu, path, vecFolders)
IsPathInVector = False ' Resolve aliases, libraries, etc. to their real/absolute paths. path = fsu.Resolve(path) Dim testPath For Each testPath in vecFolders If (fsu.ComparePath(path, fsu.Resolve(testPath))) Then IsPathInVector = True Exit Function End If Next
’ Called on double-click.
' Don't change anything if we're not in thumbnails mode. If (doubleClickData.tab.format.view <> "thumbnails") Then Exit Function End If ' Only affect left button double-clicks, with no qualifiers held down. If (doubleClickData.mouse <> "left" Or doubleClickData.qualifiers <> "none") Then Exit Function End If ' Cache the FSUtil object, for efficiency. Dim fsu Set fsu = DOpus.FSUtil ' Don't change anything if we're not in one of the configured folders. If (Not IsPathInVector(fsu, doubleClickData.tab.Path, Script.config.AlbumFolders)) Then Exit Function End If ' Don't change anything if the double-clicked item is not a folder. If (Not doubleClickData.item.is_dir) Then Exit Function End If ' Look for a .M3U or .M3U8 file below the folder. Dim folderEnum Set folderEnum = fsu.ReadDir(doubleClickData.item, false) Dim childItem Do While (Not folderEnum.Complete) Set childItem = folderEnum.Next ' Check for a .m3u extension. This also has the effect of ignoring folders, ' since folders always have an empty extension property (even if they ' have a name containing a dot), so we don't have to check that separately. If (childItem.ext = ".m3u" or childItem.ext = ".m3u8") Then ' Launch the .m3u file we found. DOpus.NewCommand.RunCommand """" & childItem & """" ' Prevent the standard double-click action. OnDoubleClick = True Exit Function End If Loop