Improved Add Favorite button - Add all selected items

The Default Add Favorite button is set to simply pop up the ADDDIALOG, which is ok, but we can do better! :slight_smile:

Here's a replacement that will add ALL SELECTED files and folders as favorites, or, if nothing is selected, will revert to the previous behaviour and simply display the ADD dialog

to use, copy the below xml chunk, Right-click in an empty space in a Dopus toolbar, click "Customize" and then right click a toolbar and choose PASTE

<?xml version="1.0"?>
<button backcol="none" display="both" hotkey="ctrl+D" label_pos="right" textcol="none">
	<label>Add To Favorites \t Ctrl + D</label>
	<icon1>#favoritesadd</icon1>
	<function type="script">
		<instruction>@script VBScript</instruction>
		<instruction>Option Explicit</instruction>
		<instruction>Function OnClick(ByRef clickData)</instruction>
		<instruction>	clickData.func.command.deselect = false &apos; Prevent automatic deselection</instruction>
		<instruction />
		<instruction>	If clickData.func.sourcetab.selected.count = 0 Then</instruction>
		<instruction>		clickData.func.command.RunCommand &quot;Favorites ADDDIALOG&quot;</instruction>
		<instruction>	Else</instruction>
		<instruction>		clickData.func.command.RunCommand &quot;Favorites ADD PATH={filepath$}&quot;</instruction>
		<instruction>	End If</instruction>
		<instruction>End Function</instruction>
	</function>
</button>
5 Likes