Jump to content

Do Folderpic


Recommended Posts

Hey,

i would like to set some ico-files as Folderpic (using Windows Vista).

the manuell way goes over customize in properties.

because i have a lot of folders, i will automate this. the ico-files are already in the folders, where they should be the folderpic.

when i do this manually, an file called "desktop.ini" is created in each folder.

so i try to create these file via autoit, but the folderpic does not change.

did somebody know a way, how i can change easily folderpics via autoit?

creating the ini-file could be a part of this routine, maybe a dllcall or somethin like that is missing ...

thank you =)

Link to comment
Share on other sites

This works sometimes, I think you need to restart explorer or something.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $sLocation = @HomeDrive
Global $sFilename = @SystemDir & "\shell32.dll"

$frmIcon = GUICreate("Change Folder Icons", 290, 187)
GUICtrlCreateGroup("", 8, 0, 273, 178)
GUICtrlCreateLabel("Folder:", 16, 16, 36, 17)
$inpLocation = GUICtrlCreateInput("", 56, 16, 217, 21)
$btnChange = GUICtrlCreateButton("Change Folder", 152, 40, 123, 25)
GUICtrlCreateLabel("Folder:", 16, 16, 36, 17)
GUICtrlCreateLabel("Icon:", 16, 68, 36, 17)
$inpIcon = GUICtrlCreateInput("", 56, 68, 217, 21)
$btnIcon = GUICtrlCreateButton("Change Icon", 152, 92, 123, 25)
$btnSave = GUICtrlCreateButton("Save", 172, 148, 99, 25)
GUICtrlCreateLabel("Index:", 16, 120, 33, 17)
$inpIndex = GUICtrlCreateInput("", 56, 120, 217, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnChange
            $sLocation = FileSelectFolder("Select Folder", @HomeDrive)
            GUICtrlSetData($inpLocation, $sLocation)
        Case $btnIcon
            $sFileName = FileOpenDialog("Select file:", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "Executables & dll's (*.exe;*.dll;*.ocx;*.icl)")
            If @error Then ContinueLoop
            GUICtrlSetData($inpIcon, $sFileName)
        Case $btnSave
            _Write(GUICtrlRead($inpLocation), GUICtrlRead($inpIcon), GUICtrlRead($inpIndex))
    EndSwitch
WEnd

Func _Write($ioLocation, $ioIcon, $ioIndex)
    $ioLocation = $ioLocation & '\desktop.ini'
    
    IniWrite($ioLocation, ".ShellClassInfo", "IconResource", $ioIcon & "," & $ioIndex)

    FileSetAttrib($ioLocation, "+SH")
    MsgBox(64, "Folder Icons", "Saved!")
EndFunc
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...