Customize Folder
Posted: 17 Apr 2008 21:32
This is a little script I wrote to make giving a folder a custom icon quicker and avoid going through the Windows Customize Folder dialogs.
It will create a desktop.ini file pointing to icon 0 of the selected and focused item.
If desktop.ini already exists the new file will have a suffix number in accordance with batch rename, you'll have to decide which you want to keep after the script completes.
Then it changes the attributes of the file and folder to apply the customization.
If you want the change to show in the tree you'll need to do a rebuild tree or add #484; to the end of this script.
It will create a desktop.ini file pointing to icon 0 of the selected and focused item.
If desktop.ini already exists the new file will have a suffix number in accordance with batch rename, you'll have to decide which you want to keep after the script completes.
Then it changes the attributes of the file and folder to apply the customization.
If you want the change to show in the tree you'll need to do a rebuild tree or add #484; to the end of this script.
Code: Select all
"Customize Folder"
//Temporarily change XY settings.
Setting("AutoRefresh", "0");
Setting("ResortAfterRename", "0");
//Store the clipboard so it can be restored.
Set("%cb%","<clipboard>");
//Put new desktop.ini contents on clipboard.
CopyText("[.ShellClassInfo]<br>IconFile=<curname><br>IconIndex=0");
//Paste clipboard as new textfile.
#219;
//Restore the clipboard.
CopyText("%cb%");
//Use batch rename so that if needed a suffix is used.
Rename("bat","desktop.ini/e","");
//Refocus the list to ensure the variables are picked up.
Focus("List");
//Change the desktop.ini's attributes to +Hidden, +System, -Archive
Open("""attrib"" +H +S -A ""<curitem>""", "w");
//Change the current folder's attributes to +Read-only
Open("""attrib"" +R ""<curpath>""", "w");