Jump to content
Sign in to follow this  
careca

Folder Icon Changer

Recommended Posts

careca

Hi, Created this to replace a bunch of batch and reg files i had to do the job,

Included the icons in the .rar

Simply select the folder and click the button, to revert you just need to click the restore button.

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=FoldersBox.ico
#AutoIt3Wrapper_Res_Icon_Add=FoldersBox.ico
#AutoIt3Wrapper_Run_Tidy=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <WinAPI.au3>
#include <GuiEdit.au3>
#include <GuiButton.au3>
#include <Constants.au3>
#include <GuiStatusBar.au3>
#include <GUIConstants.au3>
#include <GuiImageList.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("TrayMenuMode", 1)
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 0)
Opt("GUIEventOptions", 1)

$hGUI = GUICreate("AutoIt Folder Color Menu", 300, 250, 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
$hlabel = GUICtrlCreateLabel("Select a Color for the folders", 30, 10, 150, 17)
$hButton1 = GUICtrlCreateButton("Change", 30, 200)
GUICtrlSetOnEvent($hButton1, "Change")
$hButton2 = GUICtrlCreateButton("Restore Thumbnails", 90, 200)
GUICtrlSetOnEvent($hButton2, "Restore")
GUISetState()

Global $aRadio[16]
Global $aApps[16][2]

$aApps[0][0] = "White"
$aApps[0][1] = "FoldersWhite.ico"
$aApps[1][0] = "Black"
$aApps[1][1] = "FoldersBlack.ico"
$aApps[2][0] = "DarkBlue"
$aApps[2][1] = "FoldersDarkBlue.ico"
$aApps[3][0] = "Blue"
$aApps[3][1] = "FoldersBlue.ico"
$aApps[4][0] = "Brown"
$aApps[4][1] = "FoldersBrown.ico"
$aApps[5][0] = "Green"
$aApps[5][1] = "FoldersGreen.ico"
$aApps[6][0] = "Yellow"
$aApps[6][1] = "FoldersYellow.ico"
$aApps[7][0] = "Orange"
$aApps[7][1] = "FoldersOrange.ico"
$aApps[8][0] = "Red"
$aApps[8][1] = "FoldersRed.ico"
$aApps[9][0] = "Purple"
$aApps[9][1] = "FoldersPurple.ico"
$aApps[10][0] = "Violet"
$aApps[10][1] = "FoldersViolet.ico"
$aApps[11][0] = "Pink"
$aApps[11][1] = "FoldersPink.ico"
$aApps[12][0] = "Black-Blue"
$aApps[12][1] = "Foldersb&blue.ico"
$aApps[13][0] = "Black-Orange"
$aApps[13][1] = "Foldersb&orange.ico"
$aApps[14][0] = "Pdf"
$aApps[14][1] = "FoldersPDFf.ico"
$aApps[15][0] = "<Reserved>"
$aApps[15][1] = ""

For $i = 0 To 1
For $j = 0 To 7
$sName = ($aApps[($i * 8) + $j][0])
GUICtrlCreateIcon($aApps[($i * 8) + $j][1], -2, 30 + ($i * 160), 30 + ($j * 20), 17, 17)
$aRadio[($i * 8) + $j] = GUICtrlCreateCheckbox($sName, 50 + ($i * 160), 30 + ($j * 20), 138, 20)
Next
Next

Func Change()
For $i = 0 To 15
If BitAND(GUICtrlRead($aRadio[$i]), $GUI_CHECKED) = $GUI_CHECKED Then
If FileExists(@ScriptDir & '' & $aApps[$i][1]) Then
$iMsgBoxAnswer = MsgBox(36, "Confirm", 'Do you really want to' & @CRLF & 'change to the folder: ' & $aApps[$i][0] & '?')
Select
Case $iMsgBoxAnswer = 6 ;Yes
If ProcessExists('explorer.exe') Then
ProcessClose('explorer.exe')
EndIf
RegWrite('HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced', 'IconsOnly', 'REG_DWORD', '1')
RegWrite('HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShell Icons', '3', 'REG_SZ', @ScriptDir & '' & $aApps[$i][1])
RegWrite('HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShell Icons', '4', 'REG_SZ', @ScriptDir & '' & $aApps[$i][1])
;ShellExecuteWait($aApps[$i][1])
GUICtrlSetState($aRadio[$i], $GUI_UNCHECKED)
Case $iMsgBoxAnswer = 7 ;No
EndSelect
Else
MsgBox(64, "File not found!", @ScriptDir & '' & $aApps[$i][1], 0)
EndIf
EndIf
Next
EndFunc ;==>Change

Func Restore()
RegDelete('HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShell Icons', '3')
RegDelete('HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShell Icons', '4')
RegWrite('HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced', 'IconsOnly', 'REG_DWORD', '0')
If ProcessExists('explorer.exe') Then
ProcessClose('explorer.exe')
EndIf
EndFunc ;==>Restore

Do
Sleep(500)
Until $GUI_EVENT_CLOSE = 1

Func Quit()
Exit
EndFunc ;==>Quit

Download Here

Try it out and tell me if it works for you and how you would improve it!

Greetz,

Careca

EDIT: code updated, download updated.

UPDATE: Fixed problem when compiled .exe wouldn't find .ico files properly and abort the change.

post-68092-0-28926500-1352077604_thumb.p

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
JScript

Very nice, but would be even better if it were for individual folders!

Would be enough create a file called Desktop.ini with the system attribute with the following structure example:

[.ShellClassInfo]
InfoTip=
IconResource=BlueIcon.ico,0
Logo=BlueIcon.ico

Not needing to close the explorer.exe!

JS


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites
careca

Hello, thanks for input, good idea, i may look into that when i have time. :)


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
n1maS

Nicely done! Thanks.

Very nice, but would be even better if it were for individual folders!

Would be enough create a file called Desktop.ini with the system attribute with the following structure example:

[.ShellClassInfo]
InfoTip=
IconResource=BlueIcon.ico,0
Logo=BlueIcon.ico

Not needing to close the explorer.exe!

JS

Writing to Desktop.ini won't be enough. (I know about attributes)

you can use SHGetSetFolderCustomSettings (_WinAPI_ShellGetSetFolderCustomSettings in WinAPIEx.au3)

Its' much better. you don't have to force close explorer.exe. :) :)

Share this post


Link to post
Share on other sites
guinness

There is an example in the help file of WinAPIEx if you're interested in using this approach.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
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
Sign in to follow this  

×