Iconize Folders with desktop.ini

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Iconize Folders with desktop.ini

Post 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.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Iconize Folders with desktop.ini

Post by LittleBiG »

What a great idea! Thanks! :appl:

eil
Posts: 1870
Joined: 13 Jan 2011 19:44

Re: Iconize Folders with desktop.ini

Post by eil »

cool! :appl: i'll add it to my "iconizer"-button for a r-click.
Win 7 SP1 x64 100% 1366x768|1900x1080

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Iconize Folders with desktop.ini

Post 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:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply