@ifset:TREEROOT=reset

Hello, ultimately I'm trying to get Prefs -> Folder Tree -> Selection Events -> Alt + LeftMouse to toggle between Set TREEROOT=reset and Set TREEROOT={leftpath}

From everything I've read, this should be working as the script of a button, but it just does not seem to and I don't understand why:

@ifset:TREEROOT=reset
Set TREEROOT={leftpath}
@if:else
Set TREEROOT=reset

I guess that's because Set TREEROOT executes a command rather than changes a setting. So it can't be tested with @ifset. Try it out:

Set TREEROOT=reset
@ifset:TREEROOT=reset
@confirm:Yeah!
@if:else
@confirm:Darnit!

And even if you could test it, I don't think there is a command to change the preferences. The closest you can get is

Prefs mouse

We'll make it so this works in a coming update:

We'll make it so this works in a coming update:

Okay, cool. The way I read the @if/@ifset is that it should have worked.

Will I be able to put that in the Alt left mouse on tree selection events? I wasn't sure if a one-liner will work there. Alternatively, if I make a custom command, could I put the command in that one-line setting?

@if/@ifset only work with commands that, if you put them on a button, change how the button looks to indicate an on/off state.

A lot of commands do that, but not all of them. If you need new ones adding we can often do that, usually as long as checking the command's state doesn't affect performance too much.

You'll need to create a User-Defined Command via Settings > Customize Toolbars:

Like this:

Then assign that command to the tree's mouse-button event:

From a quick play around with it, I think you might want to use {filepath} instead of {leftpath}, as that way the folder you click in the tree is the one it uses as the root:

@ifset:TREEROOT=reset
Set TREEROOT={filepath}
@if:else
Set TREEROOT=reset

The older command might make sense as a hotkey or toolbar button, while this modified one is probably what you want in the tree.

Perfect, thanks!

This works perfectly in 12.14.1 Beta, thank you!

1 Like