Script to toggle list sort order

Discuss and share scripts and script files...
Post Reply
Quaraxkad
Posts: 149
Joined: 20 Apr 2014 18:01

Script to toggle list sort order

Post by Quaraxkad »

In old versions of XY, I used to press a shortcut to toggle random list order on and off. If I remember correctly, this shortcut randomized files AND folders. Pressing it again returned the the default alpha-sort with folders on top. At some point, either that changed (or I was mistaken) to only randomize files and leaves folders on top.

I want to replicate this behavior in a script. So when the script runs, the list will toggle bwteen alpha-sorted (with folders on top) and randomized (with folders mixed). I made a script that runs #331 View | Sort By | Random Order and #333 View | Sort By | Sort Folders Apart. That works to go from sorted to random, but running it again doesn't work because Sort Folders Apart acts as a toggle and Random Order doesn't.

Is there a way to script this functionality?

EDIT: I'm probably remembering versions before this:

Code: Select all

v23.50.0205 - 2022-08-25 19:28
    + Toolbar | Random Order: Now the button's context menu features the toggle "Include 
      Folders". Tick it to also shuffle the folders.
      This setting also affects the command "View | Sort By | Random Order".

highend
Posts: 14120
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Script to toggle list sort order

Post by highend »

Code: Select all

  if (get("#333")) {
    #333;
    #331;
  } else {
    #333;
    #321;
  }
?
One of my scripts helped you out? Please donate via Paypal

Quaraxkad
Posts: 149
Joined: 20 Apr 2014 18:01

Re: Script to toggle list sort order

Post by Quaraxkad »

That works, thanks!!

Post Reply