Sort by Icon

Features wanted...
Post Reply
fishgod
Posts: 227
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Sort by Icon

Post by fishgod »

Another of my crazy ideas :D

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
Last edited by fishgod on 09 Feb 2009 14:12, edited 1 time in total.
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

admin
Site Admin
Posts: 60635
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Sort by Icon

Post by admin »

fishgod wrote:Another of my crazy ideas :D

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?

fishgod
Posts: 227
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Re: Sort by Icon

Post 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
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

admin
Site Admin
Posts: 60635
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Sort by Icon

Post 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?

fishgod
Posts: 227
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Re: Sort by Icon

Post 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.
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

admin
Site Admin
Posts: 60635
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Sort by Icon

Post by admin »

Okay, I don't plan to do this, but yes, it's crazy. :)

Display
Posts: 77
Joined: 21 Apr 2015 11:20

Re: Sort by Icon

Post 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
210824_XYplorer_unsorted.png (49.71 KiB) Viewed 1353 times
-
to this:
210824_XYplorer_sorted.png
210824_XYplorer_sorted.png (64.46 KiB) Viewed 1353 times
-
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!

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

Re: Sort by Icon

Post 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)
One of my scripts helped you out? Please donate via Paypal

fishgod
Posts: 227
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Re: Sort by Icon

Post 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)
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

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

Re: Sort by Icon

Post 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...
One of my scripts helped you out? Please donate via Paypal

Display
Posts: 77
Joined: 21 Apr 2015 11:20

Re: Sort by Icon

Post by Display »

!! This is the best day ever! I've wanted this explorer function for like 20+ years! :biggrin:
I tried your approach highend but was quickly lost :oops:

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
210825_XYplorer_fishgod.png (58.3 KiB) Viewed 1300 times
best day :party:

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

Re: Sort by Icon

Post by highend »

Change sort order by desktop.ini icon content.xys
(2.17 KiB) Downloaded 56 times
Put that into your XY script folder

and then set it up:
1.png
1.png (19.64 KiB) Viewed 1297 times
Which leads to this (I didn't really assign existing icons in the desktop.ini files so they all look normal):
2.png
2.png (14.08 KiB) Viewed 1297 times
One of my scripts helped you out? Please donate via Paypal

Display
Posts: 77
Joined: 21 Apr 2015 11:20

Re: Sort by Icon

Post 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!

Post Reply