GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Create your own Folder Icon Change toolbar [UPDATED: 2.0]


#1

Here's a quick and easy way to create your own toolbar for one click setting/changing/removing of custom folder icons.



UPDATED: VERSION 2.1 FEATURES INCLUDE:

  • completely REWRITTEN code using native Windows Api functions.
  • complete unicode support
  • icon changes are immediately visible both in dopus and explorer
  • no global icon cache refreshing or dopus restarts needed anymore
    *New source code is available (3 is same as 2.1):
    IconChanger3_src.rar (19 KB)
    *The instructions to get it working are the same as in the old version.
    *Possibly not working on Pre-Vista windows - use 1.0 until fixed

About
One of the many great features of DOPUS is the folder coloring function which unfortunately falls short if you move the folder somewhere else or even rename it. So another way to mark and personalize your folder would be changing it's icon (which is also visible in windows explorer and any open/save dialogs).
Frustrated by the lack of any commandline tool to easily change folder icons and the TON of useless shareware gui solutions for this, I've released this one myself under GPL.

Step 1
Download these binaries and extract them in your Directory Opus\Apps folder.
Important: Compiled in VC10, in order for them to work you will need Visual C++ 2010 Runtimes
CLI_Icon_Changer_2.10.rar (23.1 KB)
Alternatively you can compile the source yourself. Source code is here UPDATED LINK: 2014-10-02

Step 2
Prepare your icons / icon libraries. Place them in a folder, preferably without a space in the path. ex: C:\Icons. Make sure you do not move it or your custom icons will disappear.
Absolute paths will be used so that if the same (ex: C:\Icons) folder with identical content exists on another computer and it is browsing your network shares, it will see the icons the same as you do while browsing locally.

Hint: You can find a lot of free quality icons for personal use at IconFinder

Step 3
Create a toolbar and add the button code below changing the x64 to x86 depending on the OS and DOPUS version you are using. Also change the icon paths to suit your needs. All single icon (.ico files) should always have 0 as icon index.

Set folder icon button:

<?xml version="1.0"?> <button backcol="none" display="icon" textcol="none"> <label>Set Icon 1</label> <icon1>C:\Icons\Icon1.ico,0</icon1> <function type="normal"> <instruction>@runmode hide</instruction> <instruction>@nodeselect </instruction> <instruction>@dirsonly </instruction> <instruction>&quot;/home/Apps/IconChanger_x64.exe&quot; {filepath|noterm} C:\Icons\Icon1.ico 0</instruction> </function> </button>
Set folder icon from an Icon Library:

<?xml version="1.0"?> <button backcol="none" display="icon" textcol="none"> <label>Set Icon 1</label> <icon1>C:\Icons\Iconlib.icl,15</icon1> <function type="normal"> <instruction>@runmode hide</instruction> <instruction>@nodeselect </instruction> <instruction>@dirsonly </instruction> <instruction>&quot;/home/Apps/IconChanger_x64.exe&quot; {filepath|noterm} C:\Icons\Iconlib.icl 15</instruction> </function> </button>
Clear folder icon button:

<?xml version="1.0"?>
<button backcol="none" display="icon" separate="yes" textcol="none">
	<label>Clear Icon</label>
	<icon1>#cancel</icon1>
	<function type="normal">
		<instruction>@runmode hide</instruction>
		<instruction>@nodeselect </instruction>
		<instruction>@dirsonly </instruction>
		<instruction>&quot;/home/Apps/IconChanger_x64.exe&quot; {filepath|noterm}</instruction>
	</function>
</button>

And that's it, hope you find it useful.

Old version is attached for compatibility purposes. 1.0 Source is LOST.
CLI_Icon_Changer_1.00.rar (30.9 KB)
Version 1.0 Caveats (not present in 2.0):

  • After changing an Icon you have to refresh the lister in order to see the changes.
  • When changing an Icon multiple times the OS caches the first icon and you need to restart DOPUS to see the actual icon.

#2

Hi,

This would be very useful to me, thanks. As a newbie with DOpus, however, I'm not sure where the "Apps" folder should be - I can't find it in c:\program files\GPSoftware\Directory Opus.

Does this need to be created? Or where should I look for it?


#3

It's not a standard folder so you'd have to create it. (Or put the IconChanger exe somewhere else and modify the paths in the buttons.)


#4

Thanks!

Like I said, I'm new and rather DOpus-dense.

I created a directory c:\program files\GPSoftware\Directory Opus\apps and placed the x64 version there (I'm running Win7x64). The code you used: /home/Apps/IconChanger_x64.exe... is that the same location? I'm not familiar with that syntax. Or should I enter c:\program files\GPSoftware\Directory Opus\apps\IconChanger_x64.exe?

In any case, I'm getting an error: Windows cannot find '<?xml' Is that an indication that Visual C isn't installed? That's my guess. Which leads me to asking whether I should install the package your link points to (x86) or to the x64 version?

Again, I apologize for requiring more specific instructions. Thanks.


#5

It's not my button/code :slight_smile: but /home is the same as the Opus directory so, yep, that's the same path.

You don't need Visual C. Sounds like you pasted the XML into a button instead of on to your toolbar. See the sticky post at the top of the Buttons & Toolbars forum (also in the FAQs) for what to do with XML buttons.


#6

Thanks again.

I read the FAQ and corrected what I did. I've got a button now, correctly displaying the icon I've chosen. Unfortunately, nothing happens when I click on it. :confused:

Is there some way to see a "debug" window to see what's happening? I've checked all my locations and they seem right.

Sorry to keep bugging you but this would be very useful to me in some of the work I've been doing, otherwise I'd probably wait until I've gotten more familiar with DOpus.


#7

If you want to debug it try running the tool from a Command Prompt instead of Opus. Also note that you have to restart Opus to see the changes, as mentioned in the root post. (And make sure you are really restarting Opus; not just closing its windows and re-opening them. See here.) Beyond that I don't know what to suggest as I didn't write the tool.

All it does is set the folder icon, though. You can do that from the standard Properties dialog (see here). You can also set the folder label colour via a simple built-in Opus command (see here). If you're having trouble with the approach in this thread, try the others as they are a lot more simple (and don't require restarting Opus to pick up each change).

Edit: New version 2 of the tool no longer requires restart so I've crossed out those parts to avoid confusion in the future.


#8

It seems i did not get notified of the new posts until now and I want to thank leo for taking time to respond to them.
As leo suggested you can run the program from the commandline (navigate to the place where you extracted it in dopus, right click the empty space in the file list > command prompt here) and supply it with some arguments (IconChanger.exe "c:\folder\whose\icon\you.want.to.change" "C:\Path\to\some\icon.ico" 0) and see if it generates an error or succeeds. If it succeeds then you have to revise your button code and make sure all the paths with spaces are enclosed in "quotation marks".


#9

Thank you both. What happened was that I was attempting to click on the icon when the folder was highlighted in the tree as opposed to the actual file/folder window. The former apparently does not work while the latter works perfectly.

It seems like I'm good to go now. This will be very useful! Thank you!


#10

Thanks for the update! It works great!!


#11

Yes, good update!


#12

After some tinkering I found out that the new method only works on Windows7 and Vista. It seems XP has some problem with it since it uses a unicode function Shell_GetCachedImageIndexW which appeared in Vista. I'll look into using the default version Shell_GetCachedImageIndex that appeared in XP and release an update soon. Until then XP users should use version 1.0.


#13

Is there a possibility to give every folder it's own icon/picture. Like its possible in windows explorer? I give every user in my DC a home folder with its own picture.icon.

Now Diropus does not show them. I can sent a screenshot of both

BartV


#14

[quote="BartV"]Is there a possibility to give every folder it's own icon/picture. Like its possible in windows explorer? I give every user in my DC a home folder with its own picture.icon.

Now Diropus does not show them. I can sent a screenshot of both[/quote]

Yes, that's what this thread is about.

The easiest way is via the Properties dialog, the same as in Explorer. If that isn't working, please start a thread in Help & Support with details of what you're doing and whaf is happening.


#15

@apocalypse

This works great with Windows 10.

A few workflow questions for you thought:

  1. Could you post your toolbars that already have all of the icons selected for download?

  2. Do you use a menu item or a shortcut to pop up these icon selection toolbars when you're choosing a custom icon? Curious if you could post some details about the workflow as I can't imagine having a big list of all possible icons present in DOpus all of the time... :slight_smile:

  3. Can your program be adapted to assign a custom icon to a given file?

  4. Is there a faster way to create a toolbar of icons for all the icons in my /profile/Icons rather than cutting and pasting the XML for this over and over and editing each one?

  5. Is there a way to pass DOpus aliases as a part of the path? If I hardcode the whole thing it works fine,

"/home/Apps/IconChanger_x64.exe" {filepath|noterm} C:\Users\ryan\Icons\Icons1.ico 0

But I would prefer to write something like:

"/home/Apps/IconChanger_x64.exe" {filepath|noterm} /profile/Icons/Icons1.ico 0

I've tried twenty permutations of this, but can't figure out if there is a way to get the DOpus alias interpolated before it's passed off to the external IconChanger_x64.exe command...

In any case, thanks so much for putting this together. Great tool.

-Ryan


#16

Glad you found it useful Ryan. Here goes nothing :smiley:

[quote="ouwen"]1. Could you post your toolbars that already have all of the icons selected for download?[/quote]1. I amassed a bunch of icons and while all of them are free for personal use, I'm afraid I am not allowed to redistribute them. Just visit iconfinder.com and get everything you need. Packing them in an icon library might be a good idea since it's more portable and easier to only change the index when linking to different icons.

[quote="ouwen"]2. Do you use a menu item or a shortcut to pop up these icon selection toolbars when you're choosing a custom icon?[/quote]2. Indeed I use a floating toolbar nowadays.

  • create a toolbar and add the individual icon buttons to it
    Every time I need to change a folders icon:
  • select one or more folders
  • ctrl+F8 (bound to my mouse on a per-application basis) which does
Toolbar TOGGLE NAME=IconRowX LOCAL LINE=6 STATE=float POS=mouse

This toggles the toolbar and displays it next to the mouse pointer/

  • click desired icon
  • ctrl+F8 to hide

[quote="ouwen"]3. Can your program be adapted to assign a custom icon to a given file?[/quote]3. Sadly no. File-type icons behave nothing like folder icons and with so many versions of windows the file type association has changed many times up to a point that no method to change the icon for a type (without changing the associated executable that is) is currently 100% foolproof. It's doable but quite frankly beyond the scope of this project.

[quote="ouwen"]4. Is there a faster way to create a toolbar of icons for all the icons in my /profile/Icons rather than cutting and pasting the XML for this over and over and editing each one?[/quote]4. You can edit the XML file of your toolbars directly.

  • create a new toolbar
  • add a button for an icon
  • navigate to /dopusdata\Buttons
  • open \NameOfToolbarYouCreated.dop in any text editor (I prefer notepad2)
  • start copying the same block again and again only changing the icon indexes around (if you're using an icon library)

[quote="ouwen"]5. Is there a way to pass DOpus aliases as a part of the path?[/quote]5. Afraid not - since only dopus can expand them to their full paths. Instead you could use system environment vars :

IconChanger_x64.exe C:\new "%userprofile%\Icons\Icons1.ico" 0

#17

You can pass an alias to an external program like this: {alias|dopusdata}


#18

Pure TIL material right there.
Thank you jon.
:thumbsup:

Keep in mind though that the folder icon will still be an absolute (expanded) path and will not work if you change your user folder.
I need to look into variable support of desktop.ini files in order to allow those to be kept and not expanded.


#19

@apocalypse and @jon

Thank you for all of your feedback. That was very helpful. Editing the XML for the toolbar directly definitely makes it much quicker to create an icon toolbar.

Huge fan of DOpus. It's made the switch from Unix and Mac to windows a pleasure. In fact, Mac doesn't have anything that can compete with DOpus in my opinion :slight_smile: