Play All button which automatically appears in your music folders

I have a Play All button which appears automatically on the navigation bar when I enter my designated music (sub)folders. It will automatically disappear when navigating outside the music sub(folders).

Someone might find this idea cool so I've decided to present it here.


Because of where it appears on the navigation bar (just after the path box) it's not obtrusive and its appearance/disappearance won't look jumpy or move/displace anything.

Here is the code used in the button:

@hideifpath:!C:MyMusicFolderExample\*
@filesonly
@useactivelister
Select *.(mp3|ogg|wma|aac|m4a|mp4|flac|wav|mod|xm|x3m|mid|sid)
ContextMenu Open

The ContextMenu Open works great with AIMP audio player. Others such as Foobar might require some different command.

3 Likes

For foobar I'd use

@hideifpath:!C:MyMusicFolderExample\*
foobar2000.exe {sourcepath}
1 Like

Select grp:music is probably a better option.

8 posts were split to a new topic: Help using & hiding Play All button for music

How funny. I spent whole weekend doing exactly that, only in any path.
It uses both script and a button.

I am sure the script is not perfect, as it is my first script ever in DOpus.
I don't even know why i did it, as I barely listen to music outside Spotify :wink:

The script is here:
PlayAll.js.txt (1.8 KB)

And the button here:

<?xml version="1.0"?>
<button backcol="#ff8000" display="both" icon_size="large" label_pos="right" separate="yes" textcol="#ffffff">
	<label>PLAY ALL!</label>
	<tip>Play all audio files</tip>
	<icon1>#S-DOX II DE Additional Icon Set:media_play</icon1>
	<function type="script">
		<instruction>@hideif:!$tab:musicfiles</instruction>
		<instruction>@if:common</instruction>
		<instruction>@toggle:update</instruction>
		<instruction>@script JScript</instruction>
		<instruction>function OnClick(clickData)</instruction>
		<instruction>{</instruction>
		<instruction />
		<instruction>var D = DOpus;</instruction>
		<instruction>var tabVars = DOpus.listers.lastactive.activetab.vars;</instruction>
		<instruction>var tabVarName = &apos;musicFiles&apos;;</instruction>
		<instruction>D.Output(D.Typeof(tabVars.Get(tabVarName)))</instruction>
		<instruction>var cmd = clickData.func.command;</instruction>
		<instruction>D.Output(DOpus.Typeof(tabVars.Get(tabVarName)))</instruction>
		<instruction>cmd.addFiles(tabVars.Get(tabVarName))</instruction>
		<instruction />
		<instruction>cmd.RunCommand(&quot;ContextMenu VERB=open&quot;);</instruction>
		<instruction>	</instruction>
		<instruction>}</instruction>
	</function>
</button>

I struggled a bit with understanding @toggle and tab update stuff and very rare occasions button appears only after you click at anything in the file list. But it is rare and not really a problem, I think.

4 Likes