.
► Afficher le texte
Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.0.0
Author: GELDROC
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
Opt("TrayMenuMode", 1)
Global $EXIT = TrayCreateItem("Fermer DriveIcon")
AdlibEnable("_Tray", 150)
_Set_Icon_Drive()
Func _Set_Icon_Drive()
Local $Drive, $TOTAL, $FREE, $UTILISER, $TYPE, $SelctDrive = 0, $NBR = 0, $UTILISER_H[20]
While 1
sleep(1000)
$Drive = DriveGetDrive("ALL")
If $Drive[0] <> $NBR Then
Run(@ComSpec & " /c REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons /f >nul", @SystemDir, @SW_HIDE)
For $SelctDrive = 1 to $Drive[0]
$TYPE = DriveGetType($Drive[$SelctDrive])
$TOTAL = DriveSpaceTotal($Drive[$SelctDrive])
$FREE = DriveSpaceFree($Drive[$SelctDrive])
$UTILISER = $TOTAL-$FREE
Select
Case $TYPE = "Fixed" And $Drive[$SelctDrive] = @HomeDrive
_Reg_Icon($Drive[$SelctDrive], $TOTAL, $UTILISER, "S")
Case $TYPE = "Fixed" And $Drive[$SelctDrive] <> @HomeDrive
_Reg_Icon($Drive[$SelctDrive], $TOTAL, $UTILISER, "D")
Case $TYPE = "Removable" And $Drive[$SelctDrive] = "A:"
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& _
StringLeft($Drive[$SelctDrive], 1)&"\DefaultIcon", "", "REG_SZ", @ScriptDir&"\DriveIcon.dll,"&26)
Case $TYPE = "Removable" And $Drive[$SelctDrive] <> "A:"
_Reg_Icon($Drive[$SelctDrive], $TOTAL, $UTILISER, "D")
Case $TYPE = "CDROM"
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& _
StringLeft($Drive[$SelctDrive], 1)&"\DefaultIcon", "", "REG_SZ", @ScriptDir&"\DriveIcon.dll,"&27)
EndSelect
$UTILISER_H[$SelctDrive] = $UTILISER
Next
Else
For $SelctDrive = 1 to $Drive[0]
$TYPE = DriveGetType($Drive[$SelctDrive])
If $Drive[$SelctDrive] <> "A:" then
$TOTAL = DriveSpaceTotal($Drive[$SelctDrive])
$FREE = DriveSpaceFree($Drive[$SelctDrive])
$UTILISER = $TOTAL-$FREE
EndIf
If $UTILISER_H[$SelctDrive] <> $UTILISER And $UTILISER > "0" And $Drive[$SelctDrive] <> "A:" Then
Select
Case $TYPE = "Fixed" And $Drive[$SelctDrive] = @HomeDrive
_Reg_Icon($Drive[$SelctDrive], $TOTAL, $UTILISER, "S")
Case $TYPE = "Fixed" And $Drive[$SelctDrive] <> @HomeDrive
_Reg_Icon($Drive[$SelctDrive], $TOTAL, $UTILISER, "D")
Case $TYPE = "Removable" And $Drive[$SelctDrive] = "A:"
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& _
StringLeft($Drive[$SelctDrive], 1)&"\DefaultIcon", "", "REG_SZ", @ScriptDir&"\DriveIcon.dll,"&26)
Case $TYPE = "Removable" And $Drive[$SelctDrive] <> "A:"
_Reg_Icon($Drive[$SelctDrive], $TOTAL, $UTILISER, "D")
Case $TYPE = "CDROM"
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"& _
StringLeft($Drive[$SelctDrive], 1)&"\DefaultIcon", "", "REG_SZ", @ScriptDir&"\DriveIcon.dll,"&27)
EndSelect
EndIf
If $Drive[$SelctDrive] <> "A:" then $UTILISER_H[$SelctDrive] = $UTILISER
Next
EndIf
$NBR = $Drive[0]
sleep(9000)
WEnd
EndFunc
Func _Reg_Icon($Lecteur, $TT, $UT, $TY)
Local $PX = $TT/100
Local $P = $UT/$PX
Local $P_U = stringsplit($P, ".", 1)
$P_U = $P_U[1]
Local $NI = "-1"
Select
Case $P_U < 1 And $TY = "D"
$NI = "-1"
Case $P_U < 8 And $P_U >=1 And $TY = "D"
$NI = 1
Case $P_U < 16 And $P_U >= 8 And $TY = "D"
$NI = 2
Case $P_U < 25 And $P_U >= 16 And $TY = "D"
$NI = 3
Case $P_U < 33 And $P_U >= 25 And $TY = "D"
$NI = 4
Case $P_U < 41 And $P_U >= 33 And $TY = "D"
$NI = 5
Case $P_U < 50 And $P_U >= 41 And $TY = "D"
$NI = 6
Case $P_U < 58 And $P_U >= 50 And $TY = "D"
$NI = 7
Case $P_U < 67 And $P_U >= 58 And $TY = "D"
$NI = 8
Case $P_U < 75 And $P_U >= 67 And $TY = "D"
$NI = 9
Case $P_U < 83 And $P_U >= 75 And $TY = "D"
$NI = 10
Case $P_U < 92 And $P_U >= 83 And $TY = "D"
$NI = 11
Case $P_U <= 100 And $P_U >= 92 And $TY = "D"
$NI = 12
Case $P_U < 1 And $TY = "S"
$NI = 13
Case $P_U < 8 And $P_U >=1 And $TY = "S"
$NI = 14
Case $P_U < 16 And $P_U >= 8 And $TY = "S"
$NI = 15
Case $P_U < 25 And $P_U >= 16 And $TY = "S"
$NI = 16
Case $P_U < 33 And $P_U >= 25 And $TY = "S"
$NI = 17
Case $P_U < 41 And $P_U >= 33 And $TY = "S"
$NI = 18
Case $P_U < 50 And $P_U >= 41 And $TY = "S"
$NI = 19
Case $P_U < 58 And $P_U >= 50 And $TY = "S"
$NI = 20
Case $P_U < 67 And $P_U >= 58 And $TY = "S"
$NI = 21
Case $P_U < 75 And $P_U >= 67 And $TY = "S"
$NI = 22
Case $P_U < 83 And $P_U >= 75 And $TY = "S"
$NI = 23
Case $P_U < 92 And $P_U >= 83 And $TY = "S"
$NI = 24
Case $P_U <= 100 And $P_U >= 92 And $TY = "S"
$NI = 25
EndSelect
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\"&StringLeft($Lecteur, 1)&"\DefaultIcon", "", "REG_SZ", @ScriptDir&"\DriveIcon.dll,"&$NI)
EndFunc
Func _Tray()
If TrayGetMsg() = $EXIT Then
Run(@ComSpec & " /c REG DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons /f >nul", @SystemDir, @SW_HIDE)
Exit
EndIf
EndFunc