#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: SurPriseS Script Function: Automatisation pour BorderMaker. #ce ---------------------------------------------------------------------------- #cs ---------------------------------------------------------------------------- Fichier REG : Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\Bordermaker] @="BorderMaker" "Install"="OK" [HKEY_CLASSES_ROOT\Directory\shell\Bordermaker\command] @="\"C:\\Documents and Settings\\SurPriseS\\Bureau\\bordermaker\\Autobm.exe\" \"%1\"" #ce ---------------------------------------------------------------------------- ;-----------------------------------------------------------Includes : #include #include #include ;-----------------------------------------------------------Variables : ;-----------------------------------------------------------GUI : $Form1 = GUICreate("BorderMaker Automatiser", 350, 140) cmd_ok() ; Affichage ou non du script selon si ajout dans la ligne de commande. $install_button = GUICtrlCreateButton("Install BorderMaker",230,10,110) $install_script_button = GUICtrlCreateButton("Install Script",230,40,110) $deinstall_button = GUICtrlCreateButton("Deinstall BorderMaker",230,70,110) $deinstall_script_button = GUICtrlCreateButton("Deinstall Script",230,100,110) verrif_install() ; cache/affiche les bouton While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $install_script_button install_reg() case $deinstall_script_button deinstall_reg() case $install_button install_BM() case $deinstall_button deinstall_BM() EndSwitch WEnd ;-----------------------------------------------------------Fonctions : func cmd_ok() ; Verification de l'ajout d'une ligne de commande dans le lancement du script If $CmdLine[0] = 1 Then GUISetState(@SW_hide) ; Si il y a un ajout dans ligne de commande, le script s'execute en silence $chemin = $CmdLine[1] MsgBox(0,"",$chemin) exit Else GUISetState(@SW_SHOW); Si il n'y a pas d'ajout dans la ligne de commande, le script s'affiche Endif EndFunc Func verrif_install() ; cache/affiche les bouton If FileExists("C:\Bordermaker\BorderMaker.exe") Then GUICtrlSetState($install_button, $GUI_DISABLE) GUICtrlSetState($deinstall_button, $GUI_ENABLE) Else GUICtrlSetState($install_button, $GUI_ENABLE) GUICtrlSetState($deinstall_button, $GUI_DISABLE) endif if RegRead("HKEY_CLASSES_ROOT\Directory\shell\Bordermaker","Install") then GUICtrlSetState($install_script_button, $GUI_DISABLE) GUICtrlSetState($deinstall_script_button, $GUI_ENABLE) Else GUICtrlSetState($install_script_button, $GUI_ENABLE) GUICtrlSetState($deinstall_script_button, $GUI_DISABLE) EndIf EndFunc Func install_BM() DirCreate("C:\bordermaker\") FileInstall("C:\Documents and Settings\cyber\Bureau\BorderMaker Automatiser\bordermaker.exe","C:\bordermaker\bordermaker.exe") FileCopy(@ScriptDir & "\Autobm.exe","C:\bordermaker\Autobm.exe") verrif_install() EndFunc Func deinstall_BM() FileDelete("C:\bordermaker\bordermaker.exe") verrif_install() EndFunc func install_reg() RegWrite("HKEY_CLASSES_ROOT\Directory\shell\Bordermaker","","REG_SZ","BorderMaker") RegWrite("HKEY_CLASSES_ROOT\Directory\shell\Bordermaker","Install","REG_SZ","OK") RegWrite("HKEY_CLASSES_ROOT\Directory\shell\Bordermaker\command","","REG_SZ",'"C:\bordermaker\Autobm.exe" "%1"') verrif_install() EndFunc Func deinstall_reg() RegDelete("HKEY_CLASSES_ROOT\Directory\shell\Bordermaker") verrif_install() EndFunc