Sort files in arbitary order (VBS Script)

General discussion related to "Everything".
Post Reply
meteorquake
Posts: 383
Joined: Thu Dec 15, 2016 9:44 pm

Sort files in arbitary order (VBS Script)

Post by meteorquake »

I recall asking a while back if there was some way in Everything of sorting files in an arbitrary order, without luck (understandably). The task is useful for various purposes.
I had a brainwave a moment ago about how to do this, and have written a quick VBS script (below).
The methodology is quite simple, you have the Everything window not quite maximised and the VBS file just showing at its edge, and you drag and drop files or folders one by one onto the script, and it will prefix an incremental number to the name e.g. the first one prefixes "010 "; the next one you drag will be prefixed with "020 " and so on. That's using a starting value 10 step of 10. It just stores the position and step in the registry. When these are sorted in name order, they will therefore appear in the order you actioned this. It removes any existing prefix of numbers+space so one that's already prefix will have it replaced - obviously if a file naturally begins with numbers then a space it will treat that as a prefix to be changed to a new prefix.
You can reset it and give a new starting point and step increase simply by double-clicking the script. e.g. "30,1" would have a starting point of 30 with increment 1 each drop.
The script is here, and I've appended .txt to the file name which will obvious need to be removed for it to operate -

https://www.paintdrawer.co.uk/misc/renu ... op.vbs.txt

(The line with wscriptcopy.exe is my way of covering having Controlled Folder Access on, I have a copy of wscript.exe called wscriptcopy.exe that's allowed through Controlled Folder Access, and a startup check to ensure it's kept up to date with the standard wscript.exe.)

Hopefully it may be of use to someone, I know I'll use it a huge amount as I have to assign a lot of file orders to things!

I made a suggestion some while back about having action column(s) that you can show that each provide a button against each file, with the button (for the column) assigned a custom action, this would be just the sort of task I was thinking of that would work well, as you could click the button showing against any file to action it with such a task.

David
NotNull
Posts: 5260
Joined: Wed May 24, 2017 9:22 pm

Re: Sort files in arbitary order (VBS Script)

Post by NotNull »

Everything 1.5, currently in development, has a randomize: /shuffle: function.

That has the same effect as menu:View > Sort By > Randomize.
meteorquake
Posts: 383
Joined: Thu Dec 15, 2016 9:44 pm

Re: Sort files in arbitary order (VBS Script)

Post by meteorquake »

That's good to know too - randomisation has a good many uses!
An arbitrary order here is where you want a very specific order to the files. I use it a lot to put my plant detail photos in a desirable sequence, but I've been numbering the prefixes by hand till now to achieve it. I'll find it useful also when working with files so related files fall together - I've already a VBS I did to renumber all the existing numbers back to steps of 10, which can also remove the titles, because the steps of 10 allow inserting items in between (e.g. 015 between 010 and 020) which happens rather a bit. I'll improve that so it can also remove all the prefixes for situations where the ordering is just for temporary purposes.
d
NotNull
Posts: 5260
Joined: Wed May 24, 2017 9:22 pm

Re: Sort files in arbitary order (VBS Script)

Post by NotNull »

Ah, OK. You mean something like Sort By => Manual .
(misread it ..)
meteorquake
Posts: 383
Joined: Thu Dec 15, 2016 9:44 pm

Re: Sort files in arbitary order (VBS Script)

Post by meteorquake »

Yes :) I can't see a Sort By Manual presently, but in fact this method is good for me since they are permanently ordered until the ordering is removed - I also zip them up for others to download and use, so the ordering will work for other people too.
I think the other option would be to poke the creation or modified date to create an order but then the first (creation) will be lost when a file is copied/unpacked etc and the second is lost if the file is updated (or you lose the ability to convey when it was updated). Having it as a numeric prefix in the name works very well :)
David
void
Developer
Posts: 15349
Joined: Fri Oct 16, 2009 11:31 pm

Re: Sort files in arbitary order (VBS Script)

Post by void »

Another way I thought of doing this is with:

addcolumn:column1 column1:=sha256($fullpath:) sort:column1

It's pretty slow so limit your results first.
The advantage here is the results will appear in random order, but the order is always the same.
Post Reply