Default button in @confirm

I'm using following command set:

@confirm:Do you really want to secure wipe the file?|Yes|NO
Delete SECURE

I'd like the prompt dialog to default button to "NO" in this case, since my Windows settings is set to always jump to default prompt button.

Is this currently possible?

It's currently like this:

Looks like it's not possible, as there is only one template for @confirm, that isn't changeable at the moment.

Doable with a script button:

// https://resource.dopus.com/t/default-button-in-confirm/55328

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var dlg = clickData.func.Dlg();

    cmd.deselect = false;

    dlg.title = 'DeleteSecure';
    dlg.message = 'Do you really want to secure wipe the file?';
    dlg.buttons = 'Yes|NO';
    dlg.defid = 0;

    if (dlg.Show()) cmd.RunCommand('Delete SECURE');
}
XML
<?xml version="1.0"?>
<button backcol="none" display="label" hotkey_label="yes" label_pos="right" textcol="none">
	<label>55328</label>
	<tip>default-button-in-confirm</tip>
	<icon1>#script</icon1>
	<function type="script">
		<instruction>@script JScript</instruction>
		<instruction>// https://resource.dopus.com/t/default-button-in-confirm/55328</instruction>
		<instruction />
		<instruction>function OnClick(clickData) {</instruction>
		<instruction>    var cmd = clickData.func.command;</instruction>
		<instruction>    var dlg = clickData.func.Dlg();</instruction>
		<instruction />
		<instruction>    cmd.deselect = false;</instruction>
		<instruction />
		<instruction>    dlg.title = &apos;DeleteSecure&apos;;</instruction>
		<instruction>    dlg.message = &apos;Do you really want to secure wipe the file?&apos;;</instruction>
		<instruction>    dlg.buttons = &apos;Yes|NO&apos;;</instruction>
		<instruction>    dlg.defid = 0;</instruction>
		<instruction />
		<instruction>    if (dlg.Show()) cmd.RunCommand(&apos;Delete SECURE&apos;);</instruction>
		<instruction>}</instruction>
	</function>
</button>
4 Likes

Thnx. I just modified it a bit to display a warning image along with the prompt.

// https://resource.dopus.com/t/default-button-in-confirm/55328

function OnClick(clickData) {
    var cmd = clickData.func.command;
    var dlg = clickData.func.Dlg();

    cmd.deselect = false;

    dlg.title = 'Secure Delete';
    dlg.message = 'Do you really want to secure wipe the file/folder?';
    dlg.buttons = 'Yes|No';
	dlg.icon = 'warning'
    dlg.defid = 0;

    if (dlg.Show()) cmd.RunCommand('Delete SECURE');
}

Let's not forget about sound :wink:

cmd.RunCommand('Play FILE="/windows\\Media\\Windows Notify" QUIET');