Code : Tout sélectionner
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>
;====================================================================================
; Name : Icon-Folder
; Description : Manage the icon of your folders
; Author : Jbnh <hardwarez@hotmail.co.uk>
; Note(s) : usefull tool :D
; ===================================================================================
$i = 0
If $i = 0 Then
GUICreate("Choix du Windows", 325, 175)
$xp = GUICtrlCreatePic ("ressources/xp.jpg", 25, 20, 125, 125)
GUICtrlSetTip(-1, "Windows XP")
$vista = GUICtrlCreatePic ("ressources/vista.jpg", 175, 20, 125, 125)
GUICtrlSetTip(-1, "Windows Vista")
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $xp
$i = 1
ExitLoop
Case $msg = $vista
$i = 2
ExitLoop
EndSelect
Wend
GUIDelete("Choix du Windows")
Endif
If $i = 1 Then
GUICreate("Icon_manager", 459, 210)
;-------------------------------------------------------------------------------------
GUICtrlCreatePic ("ressources/left.jpg", 6, 6, 169, 200)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Dossier", 179, 10)
$path0 = GUICtrlCreateInput("", 219, 10, 210, 20)
$btn0 = GUICtrlCreateButton("...", 434, 10, 20, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Icône", 179, 40)
$path1 = GUICtrlCreateInput("", 219, 40, 210, 20)
$btn1 = GUICtrlCreateButton("...", 434, 40, 20, 20)
;-------------------------------------------------------------------------------------
$btn2 = GUICtrlCreateButton("Create", 184, 70, 80)
$btn3 = GUICtrlCreateButton("Defaut", 269, 70, 80)
$btn4 = GUICtrlCreateButton ("Annuler ", 354, 70, 80)
;-------------------------------------------------------------------------------------
$pic1 = GUICtrlCreatePic ("ressources/help.jpg", 189, 105, 255,100)
GUISetState(@SW_SHOW)
GUICtrlSetState($Btn2, $GUI_DISABLE)
GUICtrlSetState($Btn3, $GUI_DISABLE)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btn0
$Opened_File = FileSelectFolder("Choix du dossier.", "")
GUICtrlSetData($path0, $Opened_File)
$control = GUICtrlRead($path1)
If not $control = 0 then
GUICtrlSetState($btn2, $GUI_ENABLE)
Endif
GUICtrlSetState($btn3, $GUI_ENABLE)
Case $msg = $btn1
$Opened_File = FileOpenDialog("Fichier ico", "", "All Icon files (*.ico)|All Files (*.*)",12)
GUICtrlSetData($path1, $Opened_File)
$control2 = GUICtrlRead($path0)
If not $control2 = 0 then
GUICtrlSetState($btn2, $GUI_ENABLE)
Endif
Case $msg = $btn2
If Not FileExists(GUICtrlRead($path0)&'\Desktop.ini') Then
FileWrite(GUICtrlRead($path0) & '\Desktop.ini', '[.ShellClassInfo]' & @CRLF & 'IconFile=' & GUICtrlRead($path1) & @CRLF & 'IconIndex=0')
Else
FileDelete(GUICtrlRead($path0)&'\Desktop.ini')
FileWrite(GUICtrlRead($path0) & '\Desktop.ini', '[.ShellClassInfo]' & @CRLF & 'IconFile=' & GUICtrlRead($path1) & @CRLF & 'IconIndex=0')
EndIf
$return = Run(@ComSpec & ' /c attrib +s "' & GUICtrlRead($path0) &'"', @SystemDir, @SW_HIDE)
Run(@ComSpec & ' /c attrib +h "' & GUICtrlRead($path0) &'\Desktop.ini"', @SystemDir, @SW_HIDE)
If not $return = 0 then
Msgbox(0,"Icon_manager"," Icône changé avec succès")
Else
Msgbox(0,"Icon_manager"," Erreur lors du changement d'icône")
Endif
Case $msg = $btn3
If Not FileExists(GUICtrlRead($path0)&'\Desktop.ini') Then
FileWrite(GUICtrlRead($path0) & '\Desktop.ini', '[.ShellClassInfo]' & @CRLF & 'IconFile=%SystemRoot%\system32\SHELL32.dll' & @CRLF & 'IconIndex=3')
Else
FileDelete(GUICtrlRead($path0)&'\Desktop.ini')
FileWrite(GUICtrlRead($path0) & '\Desktop.ini', '[.ShellClassInfo]' & @CRLF & 'IconFile=%SystemRoot%\system32\SHELL32.dll' & @CRLF & 'IconIndex=3')
EndIf
$return = Run(@ComSpec & ' /c attrib +s "' & GUICtrlRead($path0) &'"', @SystemDir, @SW_HIDE)
Run(@ComSpec & ' /c attrib +h "' & GUICtrlRead($path0) &'\Desktop.ini"', @SystemDir, @SW_HIDE)
If not $return = 0 then
Msgbox(0,"Icon_manager"," Icône changé avec succès")
Else
Msgbox(0,"Icon_manager"," Erreur lors du changement d'icône")
Endif
Case $msg = $btn4
ExitLoop
Case $msg = $pic1
$oIE = _IECreate ("http://www.autoitscript.fr/forum/viewtopic.php?f=6&t=1181")
EndSelect
Wend
Endif
If $i = 2 Then
GUICreate("Icon_manager", 459, 210)
;-------------------------------------------------------------------------------------
GUICtrlCreatePic ("ressources/left.jpg", 6, 6, 169, 200)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Dossier", 179, 10)
$path0 = GUICtrlCreateInput("", 219, 10, 210, 20)
$btn0 = GUICtrlCreateButton("...", 434, 10, 20, 20)
;-------------------------------------------------------------------------------------
GUICtrlCreateLabel("Icône", 179, 40)
$path1 = GUICtrlCreateInput("", 219, 40, 210, 20)
$btn1 = GUICtrlCreateButton("...", 434, 40, 20, 20)
;-------------------------------------------------------------------------------------
$btn2 = GUICtrlCreateButton("Créer", 184, 70, 80)
$btn3 = GUICtrlCreateButton("Defaut", 269, 70, 80)
$btn4 = GUICtrlCreateButton ("Annuler ", 354, 70, 80)
;-------------------------------------------------------------------------------------
$pic1 = GUICtrlCreatePic ("ressources/help.jpg", 189, 105, 255,100)
GUISetState(@SW_SHOW)
GUICtrlSetState($Btn2, $GUI_DISABLE)
GUICtrlSetState($Btn3, $GUI_DISABLE)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btn0
$Opened_File = FileSelectFolder("Choix du dossier.", "")
GUICtrlSetData($path0, $Opened_File)
$control = GUICtrlRead($path1)
If not $control = 0 then
GUICtrlSetState($btn2, $GUI_ENABLE)
Endif
Case $msg = $btn1
$Opened_File = FileOpenDialog("Fichier ico", "", "All Icon files (*.ico)|All Files (*.*)",12)
GUICtrlSetData($path1, $Opened_File)
$control2 = GUICtrlRead($path0)
If not $control2 = 0 then
GUICtrlSetState($btn2, $GUI_ENABLE)
Endif
Case $msg = $btn2
If Not FileExists(GUICtrlRead($path0)&'\Desktop.ini') Then
FileWrite(GUICtrlRead($path0) & '\Desktop.ini', '[.ShellClassInfo]' & @CRLF & 'IconResource=' & GUICtrlRead($path1) & ',0' & @CRLF & '[ViewState]' & @CRLF & 'Mode=' & @CRLF & 'Vid=' & @CRLF & 'FolderType=')
Else
FileDelete(GUICtrlRead($path0)&'\Desktop.ini')
FileWrite(GUICtrlRead($path0) & '\Desktop.ini', '[.ShellClassInfo]' & @CRLF & 'IconResource=' & GUICtrlRead($path1) & ',0' & @CRLF & '[ViewState]' & @CRLF & 'Mode=' & @CRLF & 'Vid=' & @CRLF & 'FolderType=')
EndIf
$return = Run(@ComSpec & ' /c attrib +s "' & GUICtrlRead($path0) &'"', @SystemDir, @SW_HIDE)
Run(@ComSpec & ' /c attrib +h "' & GUICtrlRead($path0) &'\Desktop.ini"', @SystemDir, @SW_HIDE)
If not $return = 0 then
Msgbox(0,"Icon_manager"," Icône changé avec succès")
Else
Msgbox(0,"Icon_manager"," Erreur lors du changement d'icône")
Endif
Case $msg = $btn3
$return = Run(@ComSpec & ' /c attrib -s "' & GUICtrlRead($path0) &'"', @SystemDir, @SW_HIDE)
If not $return = 0 then
Msgbox(0,"Icon_manager"," Icône changé avec succès")
Else
Msgbox(0,"Icon_manager"," Erreur lors du changement d'icône")
Endif
Case $msg = $btn4
ExitLoop
Case $msg = $pic1
$oIE = _IECreate ("http://www.autoitscript.fr/forum/viewtopic.php?f=6&t=1181")
Endselect
Wend
Endif