Code : Tout sélectionner
#Include<GUIConstants.au3>
#NOTRAYICON
$gui = GUICreate("Gestion de l'alimentation", 100,80)
$btn1 = GUICtrlCreateButton ("ACTIVITE", 0,0,100,20)
$btn2 = GUICtrlCreateButton ("INACTIVITE", 0,20,100,20)
$btn3 = GUICtrlCreateButton ("Intégration", 0,40,100,20)
$btn4 = GUICtrlCreateButton ("Backup", 0,60,100,20)
GUISetState()
$titre = "Propriétés de Options d'alimentation"
Do
$msg = GUIGetMsg()
Select
Case $msg = $btn1
Run("control powercfg.cpl display,,1")
WinWait($titre)
WinActivate($titre)
ControlCommand($titre, "", "ComboBox1", "SetCurrentSelection", 0)
ControlClick($titre, "", "Button5")
Case $msg = $btn2
Run("control powercfg.cpl display,,1")
WinWait($titre)
WinActivate($titre)
ControlCommand($titre, "", "ComboBox1", "SetCurrentSelection", 1)
ControlClick($titre, "", "Button5")
Case $msg = $btn3
Run(@ComSpec & " /c " & "powercfg RestoreDefaultPolicies", "", @SW_HIDE)
Run(@ComSpec & " /c " & "powercfg -h off", "", @SW_HIDE)
Run("control powercfg.cpl display,,1")
WinWait($titre)
WinActivate($titre)
Send("{TAB}")
Send("{TAB}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
Send("{ENTER}")
ControlCommand($titre, "", "ComboBox2", "SetCurrentSelection", 15)
ControlCommand($titre, "", "ComboBox3", "SetCurrentSelection", 15)
ControlCommand($titre, "", "ComboBox4", "SetCurrentSelection", 15)
ControlClick($titre, "", "Button2")
Send("Actif")
Send("{ENTER}")
ControlCommand($titre, "", "ComboBox1", "SetCurrentSelection", 0)
ControlClick($titre, "", "Button3")
Send("{ENTER}")
ControlCommand($titre, "", "ComboBox2", "SetCurrentSelection", 0)
ControlCommand($titre, "", "ComboBox3", "SetCurrentSelection", 0)
ControlClick($titre, "", "Button2")
Send("Inactif")
Send("{ENTER}")
ControlCommand($titre, "", "ComboBox1", "SetCurrentSelection", 0)
ControlClick($titre, "", "Button5")
MsgBox(0,"Intégration des modes de Gestion d'alimentation", "L'intégration des modes a été effectuée.")
Case $msg = $btn4
Run(@ComSpec & " /c " & "powercfg RestoreDefaultPolicies", "", @SW_HIDE)
Run(@ComSpec & " /c " & "powercfg -h off", "", @SW_HIDE)
MsgBox(0,"Backup des modes par défaut de Gestion d'alimentation", "Les modes de Gestion de l'alimentations ont étés remis par défaut.")
Case $msg = $GUI_EVENT_CLOSE
EndSelect
Until $msg = $GUI_EVENT_CLOSE