Page 1 of 1
Sort by Icon
Posted: 09 Feb 2009 01:10
by fishgod
Another of my crazy ideas
Tags are good, but they don't fit everywhere.
I needed another way to mark folders, so that my "tags" are usable on networkshares and also removable devices.
Simple but usefull: custom folder-icons.

with relative links to a hidden folder ".icons" on the device.
I can sort by tags, thats perfect, but sort by icon would be another revolutionary way of sorting.
What do you think about this:
- could be usefull
- totaly crazy
//edit: fixed the bb-code of the list
Re: Sort by Icon
Posted: 09 Feb 2009 09:24
by admin
fishgod wrote:Another of my crazy ideas
Tags are good, but they don't fit everywhere.
I needed another way to mark folders, so that my "tags" are usable on networkshares and also removable devices.
Simple but usefull: custom folder-icons.

with relative links to a hidden folder ".icons" on the device.
I can sort by tags, thats perfect, but sort by icon would be another revolutionary way of sorting.
What do you think about this:
[*] could be usefull
[*] totaly crazy
Sort by icon??? How do you sort images? There is not even a column for icons...
And where would the info be stored about the item-icon association?
Re: Sort by Icon
Posted: 09 Feb 2009 14:11
by fishgod
admin wrote:

Sort by icon??? How do you sort images?
Must not be sorted by the graphical-base of the icon, but maybe on the source it comes from. (Sorting by the gfx-data of the icon would be really crazy, but would also need to much performance I guess)
admin wrote:There is not even a column for icons...
Thats the crazy wish
admin wrote:And where would the info be stored about the item-icon association?
Stored in a hidden "desktop.ini"-File like this:
Code: Select all
[.ShellClassInfo]
IconFile=..\..\.icons\DVD.ico
IconIndex=0
Re: Sort by Icon
Posted: 09 Feb 2009 14:20
by admin
fishgod wrote:admin wrote:And where would the info be stored about the item-icon association?
Stored in a hidden "desktop.ini"-File like this:
Code: Select all
[.ShellClassInfo]
IconFile=..\..\.icons\DVD.ico
IconIndex=0
Aaah, now I get it! You want to exploit/abuse existing folder icons... okay, nice idea. But would only work for
folders (not files), or?
Re: Sort by Icon
Posted: 09 Feb 2009 14:35
by fishgod
admin wrote:Aaah, now I get it! You want to exploit/abuse existing folder icons... okay, nice idea. But would only work for folders (not files), or?
Would fulfill my purpose with folders only.
Files would be nice too but since the fileicon depends on either the type (you can sort by type-column) or the file itself (than you cannot sort without graphical comparison) its not as usefull as for folders where you can specify custom icons as you want it.
Re: Sort by Icon
Posted: 09 Feb 2009 14:38
by admin
Okay, I don't plan to do this, but yes, it's crazy.

Re: Sort by Icon
Posted: 24 Aug 2021 08:55
by Display
Now that there's an Icon column available, is it possible to utilise it to sort folders based on the desktop.ini icon?
I use FolderIco to set folder colours (
https://www.folderico.com) and I'd like to sort them from this:
210824_XYplorer_unsorted.png
-
to this:
210824_XYplorer_sorted.png
-
The desktop.ini's follow the same structure except for the icon name:
Desktop.ini:
Code: Select all
[.ShellClassInfo]
IconResource=C:\ProgramData\Teorex\FolderIco\icons\Win10\Blue.ico,0
Not sure if it's possible to achieve it though? Thanks for any advice or suggestions!
Re: Sort by Icon
Posted: 24 Aug 2021 09:03
by highend
Sure
Write a script that gets the desktop.ini file for each (non-recursive) subfolder, reading the content, getting the IconResource line, get only the second part after the "=", remove any resource identifier (",0"), split it into <everything after the last "\"|path of the desktop.ini file, add it to a variable, sort that variable, remove the first part up to and including "|" and then execute a sortbylist command...
Bind that script to a custom event action (changing locations, after painting the file list)
Re: Sort by Icon
Posted: 24 Aug 2021 21:56
by fishgod
You can use this Script as Custom Column to get the behaviour highend described:
Code: Select all
$res = getkey("IconResource", ".ShellClassInfo", <cc_item>."\desktop.ini"); //get IconResource-Key from INI
if($res == "") {
$res = getkey("IconFile", ".ShellClassInfo", <cc_item>."\desktop.ini"); //fallback for INI-files with IconFile and IconIndex instead of IconResource
}
return gpc($res, "base"); //use only the basename (filename without extension). This also strippes the ",0" because it appears after the extension
Or if you use ico-files (1 icon per file, Index is allways=0) you can have it as Icon-Column and not as Text-Column:
replace
gpc($res, "base") with
gettoken($res, 1, ",", "t") and use Icon-Format for the custom-column specification.
These are also sortable (sorted by icon-path)
Re: Sort by Icon
Posted: 24 Aug 2021 22:17
by highend
There isn't the need to display an icon column just to be able to sort it by the desktop.ini content...
I mean the icons do already have a color...
Re: Sort by Icon
Posted: 25 Aug 2021 08:55
by Display
!! This is the best day ever! I've wanted this explorer function for like 20+ years!
I tried your approach highend but was quickly lost
Thank you so much for the script fishgod, truly appreciate it. It works perfectly too!!
And if the icon files are numbered it'll preserve colour orders :>
Thank you again!
210825_XYplorer_fishgod.png
best day

Re: Sort by Icon
Posted: 25 Aug 2021 09:49
by highend
Change sort order by desktop.ini icon content.xys
Put that into your XY script folder
and then set it up:
1.png
Which leads to this (I didn't really assign
existing icons in the desktop.ini files so they all look normal):
2.png
Re: Sort by Icon
Posted: 31 Aug 2021 18:59
by Display
Hey that's pretty cool! Works well - didn't realise you could apply a script in that manner.
I do prefer the flexibility that having it as a column offers, but I'll definitely pick apart your script and maybe re-purpose it for something else

Thanks for taking the time to write it!