Page 1 of 1

Iconize Folders with desktop.ini

Posted: 23 Jul 2014 09:00
by bdeshi
CFI's are fine, but they're useless outside of XY. I often use this script to iconize folders globally.
Browse to the target folder, select an icon resource, and run this script.

Code: Select all

"Iniconizer"
/*
 select an icon resource in a folder, and run this script.
 Desktop.ini will be created in that folder for that icon.
 but sometimes the icon you want may reside in a subfolder
 of the root. So if you call this script without selecting
 anything, you get to choose another icon from subfolders.
*/
 if ("<curitem>" != '') && (exists("<curitem>") != 2) {
  $ico = getpathcomponent("<curitem>",file);
 } else {
  $ico = inputfile("<curpath>", /*"ico|exe|dll|icl|cpl"*/, "choose icon source");
  $ico = resolvepath($ico,"<curpath>", 1); //make relative to <curpath>
 }
  //if (exists("<curpath>\desktop.ini") != 1){new("<curpath>\desktop.ini",file);}
  setkey "$ico", "IconFile", ".ShellClassInfo", "<curpath>\desktop.ini",2;
  setkey "0", "IconIndex",".ShellClassInfo", "<curpath>\desktop.ini",2;
  attrstamp(h,1,"<curpath>\desktop.ini"); //desktop.ini hidden
  attrstamp(r,1, "<curpath>\"); //folder must be readonly to show icon
  //openwith "notepad", , "<curpath>\desktop.ini";
  //uncomment above to open the ini after creation
[/size]
It's very basic really, but it sets up the folder with a desktop.ini all right. You can always just edit the ini by hand.

Re: Iconize Folders with desktop.ini

Posted: 23 Jul 2014 14:15
by LittleBiG
What a great idea! Thanks! :appl:

Re: Iconize Folders with desktop.ini

Posted: 24 Jul 2014 01:08
by eil
cool! :appl: i'll add it to my "iconizer"-button for a r-click.

Re: Iconize Folders with desktop.ini

Posted: 28 Jul 2014 18:16
by bdeshi
A tiny update. If you call the script without selecting anything, it now allows you to choose another icon on-the-fly. The resulting path is written in desktop.ini as relative to the root folder. :wink: In my experience, many games and apps have a suitable icon in some subfolder. This update will help in that case.
Also, I noticed the script did not differentiate between files and folders as source. It doesn't do that anymore. :oops: