Folder color toolbar possible in DO?

Hi,

Here is what i want to do; I have a number of ico files which are basically folders with different colors.
What I would like to do is select a number of folders, select the folder colour/icon from a menu or a toolbar (or even a menu on a a toolbar!:P) and have DO change the ico's of the folders to the one I selected in the menu.
The ico's are stored in the images folder in DO.

How do I go about this?

Cheers,

JDM

See this thread

Well, a very simple yet working solution would be to take advantage of WinXP's desktop.ini files.

Now my example is for adding this to the context menu, but the same thing applies for a toolbar as well.

  • Edit the path to your icon in my code example below, and copy the entire thing to your clipboard:
runmode hide 
@nodeselect
attrib +S {allfilepath$}
echo [.ShellClassInfo] > {allfilepath$}\desktop.ini
echo ConfirmFileOp=0  >> {allfilepath$}\desktop.ini
echo IconFile=C:\Location\Of\Icon\File.ico  >> {allfilepath$}\desktop.ini
echo IconIndex=0  >> {allfilepath$}\desktop.ini
attrib +H +S {allfilepath$}\desktop.ini
  • In Dopus, go to: Settings -> File Types...
    Locate "All folders" and double-click it.
    On the tab called "context menu" press "new."

Name your action (e.g. "Set color: Blue"), select "Run an Opus function" and after that select "MS-DOS Batch Function." Finally, just paste the code above in the box and press Ok. Just repeat this until you've added all your colors :slight_smile:

brilliant..this works pretty much flawlessly!!!

Another question though; how do I keep the msdos box from popping up when I execute this. From what I recall, I don't see it when executing it from a menu, but if I create a button or anything like that with this code I get an msdos box popping up. Also, I'd like to add an automatic refresh after to update the folder....

Cheers,

Joris

Actually, scrap my previous post:)
For some reason the first few times I tried it, it showed the ms dos box but not after...interesting..
However, I can see two caveats:
-it doesn't work on multiple folders
-once a folder icon is changed to a certain color, it won't change to anything else!!!!

The utillity I downloaded does the trick..so though there is no real reason to try and get this to work, i'd love to run it from a toolbar and not use any utillity:)

Cheers,

Joe

The Runmode Hide at the start of the button should ensure the MS-DOS window doesn't appear while it runs. Make sure it's on the first line and there isn't a blank line before it.

Try using {filepath$} in place of each {allfilepath$} to make it work when multiple files are selected.

Add Go REFRESH to the end of the script to make Opus refresh the view. Edit: If that doesn't work reliably, try dopusrt /CMD Go REFRESH as the last line instead.

I just tested the modications suggested by nudel, and you really do need to use dopusrt to do the refresh. Just Go REFRESH will not work ( I really don't understand why, as pressing F5 works and the code for that shortcut is just Go REFRESH=source ... possible bug? ).

Anyway, here's the updated code. I tested it using a toolbar button, and I do not see the command prompt window at any point during the operation...

runmode hide attrib +S {filepath$} echo [.ShellClassInfo] > {filepath$}\desktop.ini echo ConfirmFileOp=0 >> {filepath$}\desktop.ini echo IconFile=C:\Location\Of\Icon\File.ico >> {filepath$}\desktop.ini echo IconIndex=0 >> {filepath$}\desktop.ini attrib +H +S {filepath$}\desktop.ini dopusrt /CMD Go REFRESH
(I also removed @nodeselect as it's useless due to the refresh)

It's not really a bug but how Opus handles internal and external commands. At the moment Opus, by default, doesn't wait for the external commands to complete before running the internal commands. In this case the refresh happens too soon.

At least for now you have to use things like sync: and dopusrt to work around this behaviour. It's by-design and not a bug but I'd agree that it is also not what you'd expect and can cause problems if you don't know about it.