Pour un usage privé, je lance un petit programme au lancement de ma session qui me permet de choisir plusieurs options d'actions que j'effectue tous les jours.
C'est un exemple avec des Graphic, qui permet de selectionner les boutons au clavier: Avec les Fleches du bas et du haut, et la touche Entrée. (on peut également cliquer sur les boutons avec les souris)
L'Utilisation est simple : Un pixel se balade a travers les menus, et quand il arrive sur l'action que vous souhaitez lancer, vous appuyez sur Entrée.
Il permet de vous montrer l'utilisation de AdLibEnable
De plus, pour lancer le logiciel, il faut mettre un mot de passe.
Par defaut, c'est 1234
J'attends vos commentaires, comme toujours:
► Afficher le textecode
Code : Tout sélectionner
;----------------------------------------------------------------
; Includes et options
;----------------------------------------------------------------
#include <all.au3>
#Include <Misc.au3>
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars",1)
Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
;----------------------------------------------------------------
; Déclarations des variables
;----------------------------------------------------------------
FileChangeDir(@ScriptDir)
Global $pass = "", $key = "3870", $keylen = StringLen($key)
Global $maingui,$pin,$0button,$1button,$2button,$3button,$4button,$5button,$6button,$7button,$8button,$9button
;
Global $nom_1 = "Se Relaxer" ,$nom_2 = "Crypter un Fichier" ,$nom_3 = "Generer un Mot De Passe",$nom_4 = "" ,$nom_5 = "",$nom_6 = "",$nom_7 = "",$nom_8 = "",$nom_9 = "Lancer IE.au3"
Global $chemin_pic = @ScriptDir & "\datas\img.jpg"
Global $m = 0,$n = 3, $m2,$dll = DllOpen("user32.dll")
Global const $PosX = @DesktopWidth /4 -50
Global const $PosY = @DesktopHeight /4 -50
Global const $PosDX = @DesktopWidth /2 + 100
Global const $PosDY = @DesktopHeight / 2 + 100
$m2 = $PosDX - 50
;----------------------------------------------------------------
; Lancement des programmes
;----------------------------------------------------------------
_verifmotdepasse()
;----------------------------------------------------------------
; Fonctions principales
;----------------------------------------------------------------
Func _main()
GUICreate("Timmalos Scripts Presente : Main Prog By Tim",$PosDX,$PosDY,$PosX,$PosY)
GUISetOnEvent($GUI_EVENT_CLOSE, "endscript")
_zone_graphic()
;----------------------------------------------------------------
; Demarrage de la visualisation graphique
;----------------------------------------------------------------
GuiSetState()
AdlibEnable("_sliderRight",20)
;----------------------------------------------------------------
; Boucle principale
;----------------------------------------------------------------
While 1
If BitAnd(WinGetState("Tim"),16) then ; Ligne permettant de verifier si l'utilisateur utilise le programme; Dans le cas contraire, on libere les Hotkeyset et _Ispressed()
HotKeySet("{ESC}")
Else
HotKeySet("{ESC}", "endscript")
If _IsPressed("0D",$dll) then _choix_menu()
If _IsPressed("28",$dll) then _choix_menu("Descend")
If _IsPressed("26",$dll) then _choix_menu("Monte")
EndIf
Sleep(100)
WEnd
EndFunc
Func _verifmotdepasse()
$maingui = GUICreate("Mot De Passe Requis", 170, 200)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUISetOnEvent($gui_event_close, "endscript")
$pin = GUICtrlCreateLabel("", 10, 10, 150, 20)
GUICtrlSetFont(-1, 20, 4000, 0, 'comic san serif')
$1button = GUICtrlCreateButton("1", 10, 40, 50)
GUICtrlSetOnEvent($1button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$2button = GUICtrlCreateButton("2", 60, 40, 50)
GUICtrlSetOnEvent($2button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$3button = GUICtrlCreateButton("3", 110, 40, 50)
GUICtrlSetOnEvent($3button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$4button = GUICtrlCreateButton("4", 10, 80, 50)
GUICtrlSetOnEvent($4button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$5button = GUICtrlCreateButton("5", 60, 80, 50)
GUICtrlSetOnEvent($5button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$6button = GUICtrlCreateButton("6", 110, 80, 50)
GUICtrlSetOnEvent($6button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$7button = GUICtrlCreateButton("7", 10, 120, 50)
GUICtrlSetOnEvent($7button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$8button = GUICtrlCreateButton("8", 60, 120, 50)
GUICtrlSetOnEvent($8button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$9button = GUICtrlCreateButton("9", 110, 120, 50)
GUICtrlSetOnEvent($9button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
$0button = GUICtrlCreateButton("0", 60, 160, 50)
GUICtrlSetOnEvent($0button, "_ButtonPress")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
guisetstate()
while 1
If StringLen($pass) == $keylen Then
If $pass == $key Then
GUIDelete($maingui)
_main()
Else
MsgBox(0, "", "Mauvais Mot De Passe")
EndIf
$pass = ""
GUICtrlSetData($pin, "")
ElseIf StringLen($pass) > $keylen Then
; that's some superfast clicking son!
$pass = ""
GUICtrlSetData($pin, "")
EndIf
Sleep(10)
wend
EndFunc
;----------------------------------------------------------------
; Fonctions secondaires
;----------------------------------------------------------------
Func _zone_graphic()
;GUICtrlCreatePic($chemin_pic,0,40,$PosDX,$PosDY)
;GuiCtrlSetState(-1,$GUI_DISABLE)
GuiCtrlCreateGraphic(1, 3,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_1")
GUICtrlCreateLabel($nom_1,1,3,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GuiCtrlCreateGraphic(117,3,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_2")
GUICtrlCreateLabel($nom_2,117,3,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GuiCtrlCreateGraphic(233, 3,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_3")
GUICtrlCreateLabel($nom_3,233,3,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GuiCtrlCreateGraphic(349, 3,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_4")
GUICtrlCreateLabel($nom_4,349,3,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
;:::::::::::::::::::::::::::::::
GuiCtrlCreateGraphic(1, 20,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_5")
GUICtrlCreateLabel($nom_5,1,20,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GuiCtrlCreateGraphic(117,20,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_6")
GUICtrlCreateLabel($nom_6,117,20,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GuiCtrlCreateGraphic(233, 20,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_7")
GUICtrlCreateLabel($nom_7,233,20,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GuiCtrlCreateGraphic(349, 20,115,13)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetOnEvent(-1,"_8")
GUICtrlCreateLabel($nom_8,349,20,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
;:::::::::::::::::::::::::::::::
GuiCtrlCreateGraphic(1, 37,115,13)
GUICtrlSetColor(-1, 0x0000FF)
GUICtrlSetOnEvent(-1,"_9")
GUICtrlCreateLabel($nom_9,1,37,115,13,$SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
;:::::::::::::::::::::::::::::::
Global $ba = GuiCtrlCreateGraphic(1, 3, 49,13) ; Ces trois lignes permettent de creer la partie noire qui nous servira de curseur en se deplacant.
GUICtrlSetBkColor($ba, 0x000000) ;On utilise l'etat $Gui_Disable afin de ne pas deranger l'utilisateur si il veut cliquer à la souris
GUICtrlSetColor($ba,0xFFFFFF)
GuiCtrlSetState(-1,$GUI_DISABLE) ;sur un bouton alors que ce curseur serait dessus... Ingenieux!
EndFunc
Func _choix_menu($func_1 = "") ;La plus belle fonction, incontestablement, coeur du programme :)
If $func_1 = "Monte" then
$n = $n - 17
If $n <= 0 then $n = 3
ElseIf $func_1 = "Descend" then
$n = $n + 17
If $n >= 38 then $n = 37
Else
Switch $n
Case 3
Switch $m + 24
Case 0 to 115
_1()
Case 116 to 230
_2()
Case 231 to 345
_3()
Case 346 to 460
_4()
EndSwitch
Case 20
Switch $m + 24
Case 0 to 115
_5()
Case 116 to 230
_6()
Case 231 to 345
_7()
Case 346 to 460
_8()
EndSwitch
Case 37
Switch $m + 24
Case 0 to 115
_9()
EndSwitch
EndSwitch
EndIf
EndFunc
Func _ButtonPress()
Local $digit
$pass &= GUICtrlRead(@GUI_CtrlId)
GUICtrlSetData($pin, GUICtrlRead($pin) & "*")
EndFunc
Func endscript()
Exit
EndFunc ;==>endscript
;----------------------------------------------------------------
; Fonctions lancement des sous-programmes
;----------------------------------------------------------------
Func _1()
HotKeySet("{ESC}")
ShellExecuteWait("_relax.au3","","","run")
HotKeySet("{ESC}", "endscript")
EndFunc
Func _2()
HotKeySet("{ESC}")
ShellExecuteWait("_crypte.au3","","","run")
HotKeySet("{ESC}", "endscript")
EndFunc
Func _3()
HotKeySet("{ESC}")
ShellExecuteWait("_mdp.au3","","","run")
HotKeySet("{ESC}", "endscript")
EndFunc
Func _4()
MsgBox(0,"","Aucune action associée")
EndFunc
Func _5()
MsgBox(0,"","Aucune action associée")
EndFunc
Func _6()
MsgBox(0,"","Aucune action associée")
EndFunc
Func _7()
MsgBox(0,"","Aucune action associée")
EndFunc
Func _8()
MsgBox(0,"","Aucune action associée")
EndFunc
Func _9()
MsgBox(0,"","Aucune action associée")
EndFunc
;----------------------------------------------------------------
; Threads Independants
;----------------------------------------------------------------
Func _SliderRight()
$m = $m + 5
GUICtrlSetPos($ba, $m, $n, 49, 13)
If ($m >= 463 - 51 and ($n == 20 or $n == 3 )) or ($m >= 118 - 51 and $n == 37) Then
AdlibDisable()
AdlibEnable("_SliderLeft",20)
EndIf
EndFunc ;==>_SliderRight
Func _SliderLeft()
$m = $m - 5
GUICtrlSetPos($ba, $m, $n, 49, 13)
If $m <= 1 Then
AdlibDisable()
AdlibEnable("_SliderRight",20)
EndIf
EndFunc ;==>_SliderLeft
all.au3
- (541 Octets) Téléchargé 437 fois
- script manager.zip
- (5.41 Kio) Téléchargé 407 fois