Jump to content

Folder icon change


Recommended Posts

Hello! Real noob here...

I am trying to start from the ground up and learn this program. Really ignorant on Autoit.

I looked around in Search under "icon". Looked at all 34 pages and couldn't see it(maybe just me).

Should be simple to answer:

How can I change a folder icon to "a specific icon" of my choosing using an autoit script?

Any help would be great!

Please try not to write it for me unless I beg. I really want to learn this.

Clues, links etc would be great!

Thanks!

-P

Edited by patgenn123
Link to comment
Share on other sites

Hey everyone!

This topic was started on May 11th and is now page 14! Wow does this board move fast!!!! :)

I was still wondering if anyone knew of how to do this.

I'm thinking this would be pretty easy for a sorry backward scripting AUTOIT newbie like me, but.... I know nothing! Trying to learn. Asking for clues, but not the whole script please.

Please point me with SOME clues!

Pat

Link to comment
Share on other sites

Hello Jason, Hello All,

What I am trying to do is change a folder's icon based on a word copied into a clipboard.

I'll give everyone an example.

If the clipboard contains the word "processing", create a folder icon that has a chosen icon that would help a person identify that this folder is for "processing".

If the clipboard has some other word, give it a different icon.

Within the script, have the script revert back to the normal yellow folder after the icon has been created and "viola" done!

I know I have been looking around Google for this and there is some ideas around there, but how would this work with AutoIT because I am new to this.

Thanks!

Pat

Link to comment
Share on other sites

patgenn123

Quick example:

$folder = FileSelectFolder("Choose folder...", "", 0, @MyDocumentsDir)
If @error Then Exit

$ico = FileOpenDialog("Select a file...", @MyDocumentsDir, "Icon contains files (*.ico;*.exe;*.dll)", 1)
If @error Then Exit

IniWriteSection($folder & "\" & "Desktop.ini", ".ShellClassInfo", _
                "IconFile=" & $ico & @LF & _
                "IconIndex=0" & @LF & _
                "InfoTip=AutoIt RULEZZZ!")
                
If FileSetAttrib($folder & "\" & "Desktop.ini", "+H") = 1 Then MsgBox(64, "Set Folder Icon", "Success!")
:)
Link to comment
Share on other sites

  • 2 months later...

patgenn123

Quick example:

$folder = FileSelectFolder("Choose folder...", "", 0, @MyDocumentsDir)
If @error Then Exit

$ico = FileOpenDialog("Select a file...", @MyDocumentsDir, "Icon contains files (*.ico;*.exe;*.dll)", 1)
If @error Then Exit

IniWriteSection($folder & "\" & "Desktop.ini", ".ShellClassInfo", _
                "IconFile=" & $ico & @LF & _
                "IconIndex=0" & @LF & _
                "InfoTip=AutoIt RULEZZZ!")
                
If FileSetAttrib($folder & "\" & "Desktop.ini", "+H") = 1 Then MsgBox(64, "Set Folder Icon", "Success!")
;)
i have tried this code, but it does not seem to work (WinXP). i understand what it does, and if i manually change a folder icon via rightclick>properties it writes the same Desktop.ini with the same contents and it works/refreshes the folder icon.

could it be something to do with this issue described here: http://www.pcmag.com/article2/0,1895,1558896,00.asp

and can the sample code in the artical be converted to autoit3?

EDIT: i changed the above a little and now it seems to update the folder icon streight away. :D (i'm guessing the change file attributes on the folder is forcing explorer to update/refresh it's icon?)

$folder = FileSelectFolder("Choose folder...", "", 0, @MyDocumentsDir)
If @error Then Exit

$ico = FileOpenDialog("Select a file...", @MyDocumentsDir, "Icon contains files (*.ico;*.exe;*.dll)", 1)
If @error Then Exit

IniWriteSection($folder & "\" & "Desktop.ini", ".ShellClassInfo", _
                "IconFile=" & $ico & @LF & _
                "IconIndex=0" & @LF & _
                "InfoTip=AutoIt RULEZZZ!")
FileSetAttrib($folder, "+R")
If FileSetAttrib($folder & "\" & "Desktop.ini", "+HSA") = 1 Then MsgBox(64, "Set Folder Icon", "Success!")

also, will these registry keys mentioned here do the same thing in autoit: http://resource.dopus.com/viewtopic.php?p=...509cb6989e9880e

Edited by cyanidemonkey

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

cyanidemonkey

Hmm... but above code works fine for me, try this:

$folder = FileSelectFolder("Choose folder...", "")
If @error Then Exit

$ico = FileOpenDialog("Select a file...", "", "Icon contains files (*.ico;*.exe;*.dll)", 1)
If @error Then Exit

IniWriteSection($folder & "\" & "Desktop.ini", ".ShellClassInfo", _
                "IconFile=" & $ico & @LF & _
                "IconIndex=0" & @LF & _
                "InfoTip=AutoIt RULEZZZ!")
                
FileSetAttrib($folder & "\" & "Desktop.ini", "+H")
FileSetAttrib($folder, "+R")

Edit: This should be work.

Edited by rasim
Link to comment
Share on other sites

the above works for XP, but not on Vista, we have machines that use both, so what parts of the desktop.ini file do i mod to make it work on both systems?

at the moment i am changing the desktop.ini as follows:

XP Desktop.ini:

[.ShellClassInfo]

IconFile=S:\Client Projects\Framework Latest\default_files\ico\flash.ico

IconIndex=0

InfoTip=AutoIt RULEZZZ!

Vista desktop.ini:

[.ShellClassInfo]

LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21790

InfoTip=@%SystemRoot%\system32\shell32.dll,-12689

IconResource=%SystemRoot%\system32\imageres.dll,-108

IconFile=%SystemRoot%\system32\shell32.dll

IconIndex=-237

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

Found here: http://www.eggheadcafe.com/software/aspnet...ta-does-no.aspx

I've confirmed with shell team that the API SHGetSetFolderCustomSettings

will let explorer know that the desktop.ini has been updated.

is there a way autoit script call 'SHGetSetFolderCustomSettings' to force windows explorer to refresh in vista?

i've been changing the Desktop.ini file line:

LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21790

to

LocalizedResourceName=S:\Client Projects\Framework Latest\default_files\ico\flash.ico,0

but the ico won't show on vista.

Edited by cyanidemonkey

My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.| Caffine for Winamp 2.9x and WRS 2.0 | mp3 directory cleaner | CRAP DJ | A:B:J Radio Automation Software | FFMPEG batch conversion automator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...