You are here

Desktop.ini icons

7 posts / 0 new
Last post
Bennieboj
Bennieboj's picture
Offline
Last seen: 3 years 6 months ago
Joined: 2010-09-16 07:28
Desktop.ini icons

Hi everybody,

A question:
I'd like to give all my folders inside PortableApps the icons of the app.
Since all the icons are at the same relative location and are all called appicon.ico it should be easy.
I though about something like this:


[.ShellClassInfo]
IconFile=.\App\AppInfo\appicon.ico
IconIndex=0
IconResource=.\App\AppInfo\appicon.ico,0

Then I copied this file into the 7-ZipPortable directory. Then I applied some attributes to the file. I tried 'system', 'hidden', read only', 'archived' and a lot of combinations and suggestions across the google search results but nothing works.
This works for other folders on my hard drive, but not inside the PortableApps directory.

Any ideas why this isn't working?

Bennieboj

Ken Herbert
Ken Herbert's picture
Online
Last seen: 5 min 13 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
Works fine for me using

Works fine for me on XP sp3 using attrib +s foldername from the command line.

Edit: If you do get it working, you might also want to add ConfirmFileOp=0 to your Desktop.ini as this will prevent warning messages saying you are deleteing a system folder when you try to move or delete the folder.

Bennieboj
Bennieboj's picture
Offline
Last seen: 3 years 6 months ago
Joined: 2010-09-16 07:28
Works!

Windows 7 Ultimate SP1 32 bit here.
I had the ConfirmFileOp=0 option in my original file, but then I noticed it didn't work, so I left it out for here.

Now it works, I was using the attrib +s on the desktop.ini file, not on the folder. Thanks for pointing that out!

Yes, I set the working directory!

Ken Herbert
Ken Herbert's picture
Online
Last seen: 5 min 13 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
Glad to help

I was inspired by your idea to do my own as well, but by the time I got through 20 apps (out of 160+) I decided my time would be better spent automating the process, and since I replied earlier I have maybe 90% of an app that will do it all for you.

It currently lets you select the PortableApps root folder and then it adds the desktop.ini and the system flag to all folders within it (skipping CommonFiles). I just need to add some validation to make sure that App\AppInfo\appicon.ico exists first, and some error handling and it will be done.

I will let you know when I have something worth sharing.

Bennieboj
Bennieboj's picture
Offline
Last seen: 3 years 6 months ago
Joined: 2010-09-16 07:28
AHK, my friend

I used ahk (basic) to automate the process.
I checked for help.html to exist, but the icon itself is maybe even better. Here's my code.
The desktop.ini file should be next to this file. Since I had my autohotkey inside a AHK folder inside my PortableApps folder I didn't have to select the PA root folder.

This isn't my exact code, I removed some stuff that are specifically for my drive, if something aint working, let me know Smile


#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force ; allow only one instance
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

ahkfilepath = %A_ScriptDir%\Desktop.ini

Loop, ..\*,2 ; the 2 is for folders
{
filepathwithslash = %A_LoopFileLongPath%\Desktop.ini
filepath = %A_LoopFileLongPath%\help.html ; could also be "App\AppInfo\appicon.ico"

if (FileExist(filepath))
{
; copy desktop.ini file
FileCopy, %ahkfilepath%, %filepathwithslash%

; set attrib s h to desktop.ini file
RunWait, %comspec% /c "ATTRIB +S +H "%filepathwithslash%"", , Hide
; set attrib s to folder
RunWait, %comspec% /c "ATTRIB +S "%A_LoopFileLongPath%"", , Hide
}

}

msgbox, 64, UpdateIcons , Service terminated!, 0.4
ExitApp ; Assign a hotkey to terminate this script.;

#x::
msgbox, 64, UpdateIcons , Service terminated!, 0.4
ExitApp ; Assign a hotkey to terminate this script.;

Yes, I set the working directory!

Ken Herbert
Ken Herbert's picture
Online
Last seen: 5 min 13 sec ago
DeveloperModerator
Joined: 2010-05-25 18:19
Nice

But I've been trying to teach myself C++ for a while now, so I'll stick with that.

I may end up adding some more functionality to it, like the ability to undo the changes made, only performing the changes on directories that don't already have the desktop.ini file, or adding custom content to the desktop.ini.

All in all I think I'm doing it as an excuse for another app to post on my (rather sparse) homepage since I haven't finished many of my other apps yet.

You have given me a good idea there though, I should pre-define the directory select box with %PAL:PortableAppsDir%.

Bennieboj
Bennieboj's picture
Offline
Last seen: 3 years 6 months ago
Joined: 2010-09-16 07:28
I know C++ myself...

I know C++ myself, and btw AHK is written in C++ Wink

Undoing the changes shouldn't be that hard, just reversing the S attribute of the folder. You can also add S and H to the desktop.ini, so that nobody can remove that file.

Good luck with your application Biggrin

Yes, I set the working directory!

Log in or register to post comments