CODICE
;~ PcHelper v1.0
;~ by Jack1891
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
$Form1 = GUICreate("PcHelper v1.0", 380, 380)
$menu = GUICtrlCreateMenu("File")
$Smenu = GUICtrlCreateMenuItem("Salva impostazioni",$menu)
$Smenu1 = GUICtrlCreateMenuItem("Esci",$menu)
$menu2 = GUICtrlCreateMenu("?")
$Smenu2 = GUICtrlCreateMenuItem("Informazioni",$menu2)
$Smenu3 = GUICtrlCreateMenuItem("Contatti",$menu2)
GUICtrlCreateGroup("Azione:", 10, 20, 140, 220)
GUICtrlCreateGroup("Opzioni:", 160, 20, 210, 150)
GUICtrlCreateGroup("Quando:", 10, 250, 250, 100)
$a = GUICtrlCreateRadio("Disconnetti", 20, 50)
$b = GUICtrlCreateRadio("Riavvia", 20, 75)
$c = GUICtrlCreateRadio("Spegni", 20, 100)
$d = GUICtrlCreateRadio("Stanby", 20, 125)
$e = GUICtrlCreateRadio("Blocca", 20, 150)
$f = GUICtrlCreateRadio("Spegni Monitor", 20, 175)
$g = GUICtrlCreateRadio("Nessuna azione", 20, 200)
$1 = GUICtrlCreateCheckbox("Messaggio di avviso", 170, 50)
$2 = GUICtrlCreateCheckbox("Avvia programma", 170, 75)
$3 = GUICtrlCreateCheckbox("Termina processo", 170, 100)
$4 = GUICtrlCreateCheckbox("Visibile in tray", 170, 125)
$Subito = GUICtrlCreateCheckbox("Subito", 20, 270)
$Pianificata = GUICtrlCreateCheckbox("Pianificata", 20, 295)
$EndProcesso = GUICtrlCreateCheckbox("Alla fine di un processo", 20, 320)
$Button1 = GUICtrlCreateButton("Ok", 280, 270, 80, 30)
$Button2 = GUICtrlCreateButton("Chiudi", 280, 310, 80, 30)
$Button3 = GUICtrlCreateButton("Messaggio", 290, 50, 70, 20)
$Button4 = GUICtrlCreateButton("Scegli", 290, 75, 70, 20)
$Button5 = GUICtrlCreateButton("Scegli", 290, 100, 70, 20)
$Button6 = GUICtrlCreateButton("Pianifica", 180, 295,70,20)
$Button7 = GUICtrlCreateButton("Processo", 180, 320,70,20)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
Exit
Case $menu
MsgBox(0,"Avviso","Ancora non mi è riuscito mettere questa fuzione! xD")
Case $Smenu1
Exit
Case $Smenu2
MsgBox (0, "Informazioni", "Tool utile per ''automatizzare'' delle operazioni del pc.")
Case $Smenu3
MsgBox (0, "Contatti", "Autore: Jack1891"&@CRLF&"Email: jack1891@hotmail.com")
Case $Button3
$Testo1 = InputBox("Messaggio", "Inserisci il testo:")
Case $Button4
$File1 = FileOpenDialog ("Seleziona il file",@DesktopDir,"Tutti i file (*.*)",1)
Case $Button5
MsgBox(1,"Cerca","Cerca il processo da terminare e segna il nome")
Run("taskmgr.exe")
$Processo1 = InputBox("Processo da terminare","Inserisci il nome del processo che vuoi terminare:", "?.exe")
Case $Button6
$q=InputBox("Timer v1.0","Sono le: "&@HOUR&":"&@MIN&@CRLF&@CRLF&"Immettere l'ora per il Timer:")
$time= StringSplit ($q,":")
Case $Button7
MsgBox(1,"Cerca","Cerca il processo dopo deve essere avviato il programma segna il nome")
Run("taskmgr.exe")
$Processo3 = InputBox("Processo","Inserisci il nome del processo dopo il quale deve essere avviato il programma", "?.exe")
Case $Button1
If GUICtrlRead($Subito) = $GUI_CHECKED And GUICtrlRead($Pianificata) = $GUI_CHECKED And GUICtrlRead($EndProcesso) = $GUI_CHECKED Then
MsgBox(0,"Errore", "Non puoi svolgere un operazione in questo modo")
ElseIf GUICtrlRead($Pianificata) = $GUI_CHECKED And GUICtrlRead($EndProcesso) = $GUI_CHECKED Then
MsgBox(0,"Errore", "Non puoi svolgere un operazione in questo modo")
ElseIf GUICtrlRead($Subito) = $GUI_CHECKED And GUICtrlRead($Pianificata) = $GUI_CHECKED _
Or GUICtrlRead($EndProcesso) = $GUI_CHECKED And GUICtrlRead($Subito) = $GUI_CHECKED Then
MsgBox(0,"Errore", "Non puoi svolgere un operazione in questo modo")
ElseIf GUICtrlRead($Subito) = $GUI_CHECKED Then
Help()
ElseIf GUICtrlRead($Pianificata) = $GUI_CHECKED Then
GUISetState(@SW_HIDE)
While 1
Sleep(1500)
If @HOUR = $time[1] And @MIN = $time[2] Then
Help()
EndIf
WEnd
ElseIf GUICtrlRead($EndProcesso) = $GUI_CHECKED Then
While 1
Sleep(1500)
If Not ProcessExists ($Processo3) Then
Help()
EndIf
WEnd
EndIf
EndSwitch
WEnd
Func Help()
If GUICtrlRead($a) = $GUI_CHECKED Then
MsgBox(0, "Avviso", "L'user corrente verrà chiuso tra pochi secondi.",20)
Sleep(5000)
Shutdown(0)
Exit
ElseIf GUICtrlRead($b) = $GUI_CHECKED Then
MsgBox(0, "Avviso", "Il pc verrà riavviato tra pochi secondi.",20)
Sleep(5000)
Shutdown(2)
Exit
ElseIf GUICtrlRead($c) = $GUI_CHECKED Then
MsgBox(0, "Avviso", "Il pc verrà spento tra pochi secondi.",20)
Sleep(5000)
Shutdown(1)
Exit
ElseIf GUICtrlRead($d) = $GUI_CHECKED Then
MsgBox(0, "Avviso", "Il pc verrà messo in standby tra pochi secondi.",20)
Sleep(5000)
Shutdown(32)
Exit
ElseIf GUICtrlRead($e) = $GUI_CHECKED Then
MsgBox(0, "Avviso", "Il pc verrà bloccato tra pochi secondi.",20)
Sleep(5000)
Lock()
ElseIf GUICtrlRead($f) = $GUI_CHECKED Then
Const $p1 = 274, $p2 = 61808, $Power_On = -1, $Power_Off = 2
$p3 = WinGetHandle(WinGetTitle("", ""))
$dll1 = DllOpen("user32.dll")
DllCall($dll1, "int", "SendMessage","hwnd", $p3, "int", $p1,"int", $p2, "int", $Power_Off)
Exit
ElseIf GUICtrlRead($g) = $GUI_CHECKED Then
Sleep(500)
ElseIf GUICtrlRead($1) = $GUI_CHECKED Then
MsgBox(0, "Messaggio", $Testo1)
Exit
ElseIf GUICtrlRead($2) = $GUI_CHECKED Then
Sleep(500)
Run($File1)
Exit
ElseIf GUICtrlRead($3) = $GUI_CHECKED Then
Sleep(500)
ProcessClose($Processo1)
Exit
ElseIf GUICtrlRead($4) = $GUI_CHECKED Then
Sleep(100)
EndIf
EndFunc
Func Lock()
Local $Lock, $Estremi[4]
$Lock = GUICreate("Lock", 200, 200)
GUISetBkColor(0x00000000)
GUISetState()
$dll = DllOpen("user32.dll")
While 1
$Estremi = WinGetPos($Lock)
_MouseTrap($Estremi[0], $Estremi[1]+30, $Estremi[0] + $Estremi[2], $Estremi[1] + $Estremi[3])
Sleep(500)
if _ispressed(10,$dll) And _ispressed(11, $dll) And _ispressed(12, $dll)Then
ExitLoop
EndIf
WEnd
DllClose($dll)
_MouseTrap()
Exit
EndFunc