topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 6:35 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: DONE: Autopick custom icons for folders based on resources in folder  (Read 70452 times)

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
    • View Profile
    • Donate to Member
This is an idea I had a while back, and blogged about, back when I cared about blogs: http://doctorfrog.bl...lector-software.html

Basically, I want a function similar to the way Windows will sometimes change folder icons based on what's inside them, except I want the .ico or .exe icons present inside the folder to be used instead of icons of stock images of music notes or flowers. This is one of those things that sounds simple to a non-programmer, lucky me if it actually ends up being simple to execute.

There are a few (somewhat more complicated) extensions to this idea as well (consider them nice-to-haves):
- if the resources within the folder are image files, auto-pick one of them and create an .ico from it, then apply as custom folder icon
- offer ability to create rules to apply stock icons based on the majority file types within the folder (ie. if the folder contains mainly .mp3s, apply a certain icon image)
- ability to recurse and apply icons for subdirectories, or only apply to the top tier of directories the application is aimed at
- support for creating/scaling very large icon files, for those persons who pump up their icon sizes beyond 32x32

Here's a copy of my original blog post blatherings:

I wasted some time late last week picking custom icons for some folders on my Windows XP box:



Avoiding actual work, I headed over to my games folder and started doing the same:



And I noticed something. Mostly, to pick an icon, you go to the only .exe in the folder, or the only .exe with an embedded icon, or the only .ico in the folder, and select it as your folder icon. It is a repeated, mechanical process, something that can be handled with a fairly simple program.

Such a program can be sent to crawl among a top-layer collection of folders, crib the most likely icons to be used for the folders, and present them to the user for approval, similar to Album Cover Art Downloader. If no appropriate icons are found, the program can offer a standard selection of icons from a specified .icl or folder full of icons (I'm partial to foood's delicious icons, as shown above).

All of the icons in the second image above exist in their respective folders, and are, in most cases, the only icons in the folder. They'd be ideal for this program, since they can be automatically assigned. If there are other icons in the folders, the program can just pick one and present it, along with alternate icons, for approaval, similar to Album Cover Art Downloader. I keep a bunch of general-purpose icons in a folder, and Windows of course has its Shell32.dll. If no icons are found to autopimp the folder (hey, hey! great software name!), these resources can be presented to the user to hand-pick an icon.

The following logic can be applied to automatically pick the 'correct' icon:
If there is only one icon available (.ico, .icl, .exe), use it. Otherwise: Use the icon with the highest resolution, most colors, etc. (This avoids picking an icon from a .exe that isn't the main program in the folder, since icons designed to represent a program usually contain multiple resolution and color depth versions, and 'helper'programs are often given a more generic icon.)

Does something like this exist? And, am I the only one who thinks it should?
« Last Edit: February 21, 2008, 12:42 PM by mouser »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #1 on: February 01, 2008, 07:19 AM »
This can be done, it isn't much of a task and it's pretty cool ;)

The icon of the folder is stored under a hidden system file inside that folder called desktop.ini.
Thus, changing the info on that file is pretty easy.

Now, the big problem i can see, is when there are several icons/executables on the same folder. Also notice that if you have 2 icons with a different name, they'll be identified as being a different icon even if the image is the same (fixing this isn't trivial).

So... My option would be: for a first version, make it add the first icon/executable it finds or instead, if there are multiple choices, add none. And for a next version, we could add something like a popup asking the user to choose between the icon options on the folder.

Regarding the "extras"... Only the option on recursion is trivial, the first one is complex, the second one is doable (depends on how much attention the app gets), and the fourth one... I don't think i get what you mean :)

What do you think?

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 23
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Read more about this member.
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #2 on: February 01, 2008, 08:31 AM »
I created a VBScript awhile back that does something like this. Let me know what you think. I am happy to revisit it and make updates.
http://gogogadgetsco.../scripts/iconany.php
Snap2.jpg

GoGoGadgetScott

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #3 on: February 01, 2008, 10:13 AM »
That's pretty decent there, Scott, and embodies my idea well. Barring the production of a formal app, I think I can make do with this. I suppose I could remove the customization by finding all desktop.ini files in a directory structure and deleting them?

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #4 on: February 01, 2008, 10:16 AM »
Yep, doctorfrog, deleting the desktop.ini files should do the trick :)

BigJim

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
  • I have seen the light!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #5 on: February 01, 2008, 10:37 AM »
Barring the production of a formal app

Having done what you've already done ... why not follow through and create the app? It sounds pretty useful to me!
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #6 on: February 01, 2008, 11:46 AM »
If I had the chops, I'd do it :-) However, I am at best a power user. I was just able to figure out how to adjust the script to do it's thing somewhere other than g:\apps (which it does as a default).

Is it possible to compile a VBScript to run as a Visual Basic .exe? If so, you can add in:
- a user prompt for specifying directory
- an option so the user can whether or not it is appropriate to recurse subdirectories
- a cleanup option that runs through and deletes all desktop.ini files, or removes the icon entries in them

If not possible, well, shucks.

BigJim

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 178
  • I have seen the light!
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #7 on: February 01, 2008, 12:12 PM »
... well, shucks
Language!! We do have standards here, you know.  :D

I hear what you're saying. But there are lots of nice and talented folks here. One may take the baton. (hint!)  :eusa_dance:
TruckerJim says "You can go down a hill too slow a thousand times. But too fast only once."

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 23
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Read more about this member.
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #8 on: February 01, 2008, 12:17 PM »
I will happily convert to a desktop Visual Basic app. I like doctorfrog ideas and can easily implement. Does anyone have problem with a .net requirement?

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #9 on: February 01, 2008, 12:49 PM »
I can live with it. ;-)

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #10 on: February 01, 2008, 01:10 PM »
I just gave it a go with ahk, and had the most frustrating hour ever!

After all, it looks like creating the .ini file isn't enough!!
And it looks like ahk has a huge stupid bug with file-pattern loops!!

Thus, i'm sorry but i can't keep this one.

gogogadgetscott: please do, amaze us! :D

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #11 on: February 02, 2008, 09:30 AM »
Another request, if there's room. I realize this one will require some further program logic:

If the first icon resource (exe) the script encounters does not have an icon present, move to the next resource. Good example: 7zip. The directory is full of headless exe's, but the one with the icon resources is the 7zFM or some such.

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 23
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Read more about this member.
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #12 on: February 04, 2008, 09:07 PM »
IconAnyFolder v0.1 - First Release (written in C#)

Features
- a user prompt for specifying directory
- an option loop recursively into subdirectories
- a cleanup option that runs through and deletes all desktop.ini files, or removes the icon entries in them
- If the first icon resource (exe) the script encounters does not have an icon present, move to the next resource.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #13 on: February 05, 2008, 07:55 AM »
Wow this looks great! how did i overlook this thread the first time!

gogogadgetscott, really nice work!  :Thmbsup: :Thmbsup:

doctorfrog

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 140
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #14 on: February 06, 2008, 12:39 AM »
Wow, a guy blinks and look what happens! Thanks a lot, Scott!

jojo99

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 40
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #15 on: February 10, 2008, 05:08 AM »
Looks like you guys missed this program:
http://qad.dcmembers...p/category/freeware/

I've been using this for a while and it works well.  Compared to te program in this thread, it doesn't loop through folders and sub-folders though.

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Autopick custom icons for folders based on resources in folder
« Reply #16 on: February 10, 2008, 05:17 AM »
Now that's interesting... It's hosted on donationcoders and yet i had never heard of it! :)

robinsiebler

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 83
    • View Profile
    • Donate to Member
Re: DONE: Autopick custom icons for folders based on resources in folder
« Reply #17 on: February 22, 2008, 05:28 PM »
It sounds great!  However, I don't actually care about the folders per se.  However, I want to do something similar.  I would like all of the subfolders in my Games start menu to have the actual icon for the game.  I've done this manually for many of them and it is a pain as I have over 50 games installed.
Happiness is laced with shards of pain

nogojoe

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 169
    • View Profile
    • Donate to Member
Re: DONE: Autopick custom icons for folders based on resources in folder
« Reply #18 on: February 27, 2008, 02:02 PM »
Hi
this is more for gogogadgetscott.

Love your program and I have included a shortcut to the sendto menu on my computer.
when I  right click a folder and get to your program in the send to menu iconanyfolder opens up at the last folder that I had used with iconanyfolder. Instead of opening up with the folder that I had right clicked in the first place.
It means having to scroll through the directories to find the folder that you want to action on.
It would be good if that could be amended at some time as an enhancement.

nogojoe
Often the most convincing people are those who have lost the plot so much they don't recognize the difference between fact and fantasy

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: DONE: Autopick custom icons for folders based on resources in folder
« Reply #19 on: February 28, 2008, 09:27 AM »
this was mentioned on Shell Extension City today -- congratulations to scott and everyone else involved.

SirSmiley

  • Member
  • Joined in 2007
  • **
  • Posts: 64
    • View Profile
    • Donate to Member
Re: DONE: Autopick custom icons for folders based on resources in folder
« Reply #20 on: February 28, 2008, 05:07 PM »
Crap, mouser beat me to it! :D

Anyway Congrat's on the feature.  :Thmbsup:

Your original Vbscript is sexy clean.

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Very nice.

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
I also wish that it would not change the modified date of the folder

hairball

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 3
    • View Profile
    • Donate to Member
Hi all,

I was playing around with this app and changed the background on a folder, and now i can’t read the text in that folder, and wanted to remove the background but cant.
Anybody have any ideas on how to remove the background once it’s been applied?

Thanks!

SirSmiley

  • Member
  • Joined in 2007
  • **
  • Posts: 64
    • View Profile
    • Donate to Member
Open the desktop.ini file and delete the background image or just delete the desktop.ini file.