Button to toggle manual sorting & view mode

I quite regularly find the need to sort images into a custom order and would like to create a button that allows me to do this easily. I want to create a button that toggles between two states:

a) Manual sort mode ON, View mode set to Details + Thumbnails
b) Manual sort mode OFF, View mode set to Details

Here's what I have:

@ifset MANUALSORT=off
Set VIEW=Details
Set COLUMNSADD=thumbnail(0,96)
Set MANUALSORT=on
@ifset:else
Set MANUALSORT=off
Set VIEW=Details

But it's not working. It seems to also fire the second if:else clause for some reason? Can anyone advise what I'm doing wrong?

Thanks.

There should be a : after @ifset.

Do you want to remove the thumbnails column as well? This fixes the first line and also adds that:

@ifset:MANUALSORT=off
Set VIEW=Details
Set COLUMNSADD=thumbnail(0,96)
Set MANUALSORT=on
@ifset:else
Set MANUALSORT=off
Set VIEW=Details
Set COLUMNSREMOVE=thumbnail

Legend, thanks! :slight_smile:

Actually, there seems to be one small issue with this; the button state shows as highlighted when it's not activated (ie. manual sort mode is off), and vice versa when it's on. Is there a way to fix this? (I've read that putting an asterix next to a state in the script will show the button as highlighted when that state is activated, but I can't get it to work in the context of this script)

You can use @toggle to override when the button is highlighted:

@toggle:if Set MANUALSORT=on
@if:Set MANUALSORT=off
Set VIEW=Details
Set COLUMNSADD=thumbnail(0,96)
Set MANUALSORT=on
@if:else
Set MANUALSORT=off
Set VIEW=Details
Set COLUMNSREMOVE=thumbnail

I also changed from @ifset to the newer, more general @if as it keeps things more uniform.

Ah awesome! thanks- I'm learning now... :wink:

1 Like