topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Sunday October 13, 2024, 8:47 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: IDEA: Drag and drop folder icon replacer  (Read 35525 times)

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
IDEA: Drag and drop folder icon replacer
« on: July 17, 2016, 05:56 PM »
First, a little bit of theory. What happens when a person sets a custom icon for a folder in Windows 7?
1. Attributes of a Folder change to Read-only (of the folder, NOT content!).
2. A hidden system file desktop.ini created inside that folder, which contains a link to the icon.

Possible app:
1. drag n drop folder
2. drag n drop icon
3. icon is copied to the folder, desktop.ini is created. ini and ico set hidden

desktop.ini content:
[.ShellClassInfo]
IconResource=mynewshinyicon.ico,0

or

[.ShellClassInfo]
IconIndex=0
iconfile=mynewshinyicon.ico
« Last Edit: July 17, 2016, 06:25 PM by Rockets »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #1 on: July 17, 2016, 06:15 PM »
First, a little bit of theory. What happens when a person sets a custom icon for a folder in Windows 7?
1. Attributes of a Folder change to Read-only (of the folder, NOT content!).

If I'm not mistaken, it's not the read-only attribute that's important; it's the System attribute that is necessary.


Possible app:
1. drag n drop folder
2. drag n drop icon
3. icon is copied to the folder, desktop.ini is created

I can easily adapt my "MT Icon" Coding Snack for this.

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #2 on: July 17, 2016, 06:22 PM »
That was a fast reply, I added "hidden" to 3.

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #3 on: July 17, 2016, 06:39 PM »
I tried MT Icon. I like it, could u also modify it to change icon for all subfolders? Regardless empty or not. Like adding * to allowed filenames.

You were right:
The desktop.ini should have the attribute of system, and the folder containing it also needs to have the attribute of system for it to have an effect.
« Last Edit: July 17, 2016, 09:02 PM by Rockets »

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #4 on: July 18, 2016, 09:05 AM »
I can whip an app up like this if you still interested.

kunkel321

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 601
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #5 on: July 18, 2016, 09:09 AM »
Cool idea!  I guess you could also make an option where the ico file would also be copied to the folder, thus making it a "portable" folder.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #6 on: July 18, 2016, 10:06 AM »
I can whip an app up like this if you still interested.

I have this almost ready to go.  Just took some slight modifications to an app I had already written.

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #7 on: July 18, 2016, 10:21 AM »
Well, he'll have a choice! I'm just about to upload my app.  :D

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #8 on: July 18, 2016, 10:24 AM »
FolderIconDrop - https://cl.ly/3d1P3M0r3e2R

Drag/drop a folder and icon and press Go!

Screen Shot - https://cl.ly/1z1W1F0a181o


Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #9 on: July 18, 2016, 12:02 PM »
Drag/drop a folder and icon and press Go!
it seems just what I need, is it possible to keep .ico file name? And make autoclose optional, please.
If I drag and drop the first time, everything is OK. If I drag and drop the same folder 2nd time, it doesn't work. Browse works.

Some icon changer apps write IconResource and not IconFile.
If there are both IconResource and IconFile in desktop.ini, IconFile is ignored.
It would be better to replace
IconIndex=0
iconfile=mynewshinyicon.ico
with
IconResource=mynewshinyicon.ico,0
« Last Edit: July 18, 2016, 12:22 PM by Rockets »

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #10 on: July 18, 2016, 12:05 PM »
I have this almost ready to go.
Please add * (include all folders, empty and not) option to "MT Icon". c.gingerich's FolderIconDrop works well!

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #11 on: July 18, 2016, 02:12 PM »
Update to 1.1

Added icon index option
Optional auto-close
Optional auto-clear

[EDIT] Here is the web page for info and download - http://vdsfreak.com/...44150/foldericondrop
« Last Edit: July 18, 2016, 02:30 PM by c.gingerich »

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #12 on: July 18, 2016, 02:35 PM »
Added icon index option
it still uses:
IconFile=XXX.ico
IconIndex=0
can you replace these 2 lines with:
IconResource=XXX.ico,0
?

.ico file is not hidden anymore, desktop.ini is.

If I add folder where I already changed icon with FID, drag n drop still broken for this folder.


c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #13 on: July 18, 2016, 03:22 PM »
Fixed the folder drag/drop bug and the hidden icon. I added xxxx.ico,0 for the resource but also left IconResource=0 as that is what Win 10 uses. if I use xxxx.ico,0 on my system it doesn't work. Can anyone else confirm that?

http://vdsfreak.com/...44150/foldericondrop


Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #14 on: July 18, 2016, 03:54 PM »
Can anyone else confirm that?
confirmed, win 10 home. It seems I have to reedit all my desktop.ini files if I upgrade my main PC to Win 10. I am on Win 7 now.

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #15 on: July 18, 2016, 03:59 PM »
I added xxxx.ico
don't see it
can you make it optional what to use?

One more problem, how can we refresh icons cache in Win 7 and 10? Rebuild Shell Icon Cache doesn't work for me
http://www.sordum.or...ell-icon-cache-v1-1/
« Last Edit: July 18, 2016, 04:26 PM by Rockets »

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #16 on: July 18, 2016, 04:31 PM »
confirmed
unconfirmed. IconResource is working under win 10. What permissions does your app set?I will try to understand why.

PS: Windows 10 doesn't refresh icon folder everytime. I will try to find any solution.
Found this:



Use a shell function that will notify all running Explorer windows to use the updated desktop.ini. This API is exposed in VBScript via Shell.Application.NameSpace("folder\").MoveHere:

@echo off
for /r %%I in (*.ico) do (
    attrib -h -s -r "%temp%\desktop.ini" >nul
    (
        echo [.ShellClassInfo]
        echo IconResource="%%~nxI",0
    )>"%temp%\desktop.ini"
    attrib +h +s "%temp%\desktop.ini"
    (
        echo set shell = CreateObject^("Shell.Application"^)
        echo set folder = shell.NameSpace^("%%~dpI"^)
        echo folder.MoveHere "%temp%\desktop.ini", 4+16+1024
    )>"%temp%\updateIcon.vbs"
    cscript //nologo //b "%temp%\updateIcon.vbs"
)
pause
P.S. I forgot most of VB so whoever remembers it may rewrite the entire code in VBS (embedded).


How can I run this code?
http://stackoverflow...matically-in-windows
« Last Edit: July 18, 2016, 04:40 PM by Rockets »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #17 on: July 18, 2016, 05:25 PM »
Apologies for the delay; here's my offering: FolderIconTool

2016-07-18_172414.pngIDEA: Drag and drop folder icon replacer

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #18 on: July 18, 2016, 05:36 PM »
I tried under Win 7 and 10 to change folder icon with right click-properties-customize-change icon

Windows writes in both cases IconResource=XXX.ico,0, so we can delete
IconFile=XXX.ico
IconIndex=0
completely. It is not needed at all.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #19 on: July 18, 2016, 05:38 PM »
I tried under Win 7 and 10 to change folder icon with right click-properties-customize-change icon

Windows writes in both cases IconResource=XXX.ico,0, so we can delete
IconFile=XXX.ico
IconIndex=0
completely. It is not needed at all.

Does it really matter if it's there or not?

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #20 on: July 18, 2016, 05:41 PM »
FolderIconTool
If it is not hard for you, please replace
IconFile=XXX.ico
IconIndex=0
with
IconResource=XXX.ico,0
Does it really matter
IconResource=XXX.ico,0 has more priority, if desktop.ini already has it, IconFile will be ignored.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #21 on: July 18, 2016, 05:45 PM »
Please re-download and see if this version works as you desire.

Rockets

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 57
    • View Profile
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #22 on: July 18, 2016, 06:06 PM »
if this version
It seems perfect now. The last problem is not so important:
we have to say windows explorer to refresh folder's icon. If a folder already had an icon, it takes forever to see the new one.

PS: c.gingerich's app uses the whole window for drag n drop and automatically detects where ico and folder should go, so it is more convinient on a touchscreen.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #23 on: July 18, 2016, 06:14 PM »
It's always really fun to see threads like this.  :Thmbsup:

And it's my duty to remind everyone reading these threads to consider sending a little donation to the coders to say thanks (skwire and c.gingerich in this case); just click on the yellow dollar signs under their names.

c.gingerich

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 748
    • View Profile
    • The Blind House
    • Donate to Member
Re: IDEA: Drag and drop folder icon replacer
« Reply #24 on: July 18, 2016, 06:29 PM »
I'll update mine tomorrow and see if I can build in rebuilding the icon cache.

@mouser thanks!  :Thmbsup: