Je suis débutant sur Autoit et j'essai de me faire une petite interface GUI pour le lancement de divers programmes.
Voici mon code :
Code : Tout sélectionner
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $Form1 = GUICreate("Mon launcher", 1020, 700, -1, -1, BitOR($WS_POPUP,$WS_CLIPSIBLINGS)) ; Création fenêtre, dimension x et y, emplacement, sans contour
Global $Pic = GUICtrlCreatePic("Images\globe.jpg", 0, 0, 1020, 700) ; Choix image en arriére plan, dimension x et y
GUICtrlSetState($Pic, $GUI_DISABLE) ; Pour afficher l'image en arriére plan
;Création entête
$Accueil = GUICtrlCreateLabel("Bienvenue !", 30, 22,260,25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT); Met le label transparent
$user = GUICtrlCreateLabel("Bonjour " & @UserName, 860, 30,200,20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT); Met le label transparent
GUICtrlCreatePic('Images\user.gif',958, 20, 32, 32)
;Création pied de fenêtre
$date = GUICtrlCreateLabel("Dernières informations, nous sommes le " & @MDAY & "/" & @MON & "/" & @YEAR & ".", 30, 600, 500, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT); Met le label transparent
$file = FileRead(@ScriptDir & "\info_atelier.txt")
$piedinfo = GUICtrlCreateLabel($file, 30, 620, 800, 54)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT); Met le label transparent
$sorti = GUICtrlCreatePic('Images\sortie.gif',958, 640, 32, 32)
AdlibRegister("_maj",900000); Lance la mise à jour de la fonction _maj, 900000 = 15 minutes en ms
;Styles
GUICtrlSetFont($Accueil, 16, 400, 1, "calibri")
GUICtrlSetColor ($Accueil, 0xFFFFFF)
GUICtrlSetColor ($user, 0xFFFFFF)
GUICtrlSetColor ($piedinfo, 0xFFFFFF)
GUICtrlSetFont($date, 12, 400, 1, "calibri")
GUICtrlSetColor ($date, 0xFFFFFF)
GUICtrlSetColor ($sorti, 0xFFFF00)
;Création des boutons
;Première colonne
Global $DI = GUICtrlCreatePic('Images\dossiers.gif',30, 70, 205, 100)
Global $FI = GUICtrlCreatePic('Images\fichesinter.gif',30, 175, 205, 100)
Global $Checkcq = GUICtrlCreatePic('Images\checklistcq.gif',30, 280, 100, 100)
Global $Emballage = GUICtrlCreatePic('Images\emballage.gif',135, 280, 100, 100)
Global $Indicateur = GUICtrlCreatePic('Images\indicateur.gif',30, 385, 205, 100)
;Deuxième colonne
Global $Annuaire = GUICtrlCreatePic('Images\annuaire.gif',275, 70, 100, 100)
Global $Catalogue = GUICtrlCreatePic('Images\catalogue.gif',380, 70, 100, 100)
Global $Codecouleur = GUICtrlCreatePic('Images\codecouleurs.gif',485, 70, 100, 100)
Global $Maintenance = GUICtrlCreatePic('Images\maintenance.gif',275, 175, 100, 100)
Global $Planningperso = GUICtrlCreatePic('Images\planningpersonnel.gif',380, 175, 100, 100)
Global $Logos = GUICtrlCreatePic('Images\logos.gif',485, 175, 100, 100)
Global $listeclient = GUICtrlCreatePic('Images\listeattributions.gif',275, 280, 205, 100)
Global $polyver = GUICtrlCreatePic('Images\polyver.gif',275, 385, 100, 100)
Global $calculatrice = GUICtrlCreatePic('Images\calculatrice.gif',380, 385, 100, 100)
;Troisième colonne
Global $ERP = GUICtrlCreatePic('Images\ERP.gif',680, 70, 205, 100)
Global $Bidouille = GUICtrlCreatePic('Images\Bidouille.gif',680, 175, 205, 100)
Global $Requete = GUICtrlCreatePic('Images\Requete.gif',680, 280, 205, 100)
Global $outlook = GUICtrlCreatePic('Images\outlook.gif',680, 385, 100, 100)
Global $word = GUICtrlCreatePic('Images\word.gif',785, 385, 100, 100)
Global $excel = GUICtrlCreatePic('Images\excel.gif',890, 385, 100, 100)
;~ Global $internet = GUICtrlCreatePic('Images\internet.gif',790, 70, 100, 100)
Global $viewmate = GUICtrlCreatePic('Images\viewmate.gif',890, 280, 100, 100)
Global $intranet1 = GUICtrlCreatePic('Images\intranet1.gif',890, 70, 100, 100)
Global $intranet2 = GUICtrlCreatePic('Images\intranet2.gif',890, 175, 100, 100)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
;Actions boutons
Case $DI
ShellExecute("C:\Programmes\Raccourci")
Case $FI
If StringLeft(@ComputerName,5) = "DS" Then ShellExecute("explorer.exe","C:\Programmes\Interface\FI.xlsm")
If StringLeft(@ComputerName,5) <> "DS" Then MsgBox(0,"Information","Fonction non disponible sur votre serveur. Merci de vous connectez à un serveur DS")
Case $Checkcq
ShellExecute("C:\Programmes\Interface\GED.xls")
Case $Emballage
ShellExecute("C:\Programmes\Interface\GESTION\EMBALLAGE.XLS")
Case $Maintenance
ShellExecute("C:\Programmes\Interface\Maintenance\bon de travail.xls")
Case $Catalogue
ShellExecute("C:\Programmes\Interface\Catalogue.html")
Case $Codecouleur
ShellExecute("C:\Programmes\Interface\Code_couleurs.html")
Case $Logos
ShellExecute("C:\Programmes\Interface\Liste_logos_fabricants\Liste.html")
Case $Indicateur
If StringLeft(@ComputerName,5) = "DS" Then ShellExecute("explorer.exe","C:\Programmes\Interface\Indicateur.xlsm")
If StringLeft(@ComputerName,5) <> "DS" Then MsgBox(0,"Information","Fonction non disponible sur votre serveur. Merci de vous connectez à un serveur DS")
Case $Annuaire
ShellExecute("C:\Programmes\Interface\N°Tel.xls")
Case $Planningperso
ShellExecute("C:\Programmes\Interface\PLANNING CONGES.xls")
Case $listeclient
ShellExecute("C:\Programmes\Interface\liste clients.xls")
Case $polyver
ShellExecute("C:\Programmes\Interface\_Preparation")
Case $ERP
If StringLeft(@ComputerName,5) = "DS" Then Run("C:\Program Files (x86)\ERP.exe")
If StringLeft(@ComputerName,7) = "TSE" Then Run("C:\Program Files\ERP.exe")
Case $Bidouille
Run("C:\Program Files (x86)\Bidouille.exe")
Case $Requete
If StringLeft(@ComputerName,5) = "DS" Then Run("C:\Program Files (x86)\Requete.exe")
If StringLeft(@ComputerName,7) = "TSE" Then Run("C:\Program Files\Requete.exe")
Case $outlook
If StringLeft(@ComputerName,5) = "DS" Then ShellExecute("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Outlook 2007.lnk")
If StringLeft(@ComputerName,7) = "TSE" Then ShellExecute("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")
Case $word
If StringLeft(@ComputerName,5) = "DS" Then ShellExecute("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Word 2007.lnk")
If StringLeft(@ComputerName,7) = "TSE" Then ShellExecute("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE")
Case $excel
If StringLeft(@ComputerName,5) = "DS" Then ShellExecute("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2007.lnk")
If StringLeft(@ComputerName,7) = "TSE" Then ShellExecute("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE")
;~ case $internet
;~ Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe")
Case $intranet1
ShellExecute("http://intranet/")
Case $intranet2
ShellExecute("http://intranet2/")
Case $calculatrice
Run("calc.exe")
Case $viewmate
If StringLeft(@ComputerName,5) = "DS" Then Run("C:\Program Files (x86)\PentaLogix\ViewMate 10.2\ViewMate.exe")
If StringLeft(@ComputerName,7) = "TSE" Then Run("C:\Program Files\Pentalogix\ViewMate 9.0\ViewMate.exe")
If StringLeft(@ComputerName,9) = "TSE2" Then Run("C:\Pentalogix\ViewMate 9.0\ViewMate.exe")
Case $sorti
Exit
EndSwitch
WEnd
Func _maj()
$file = FileRead(@ScriptDir & "\info_atelier.txt")
GUICtrlSetData($piedinfo,$file)
EndFuncEt la je suis obligé de tuer la tâche pour retrouver mon système. Cela est très étrange car sans faire de raccourci sur le programme tout fonctionne correctement.
Du coup je me demande si cela ne vient pas d'une variable mal définie ou mettre de la structure complète de ma GUI.
Pouvez-vous jeter un oeil sur le code et me conseillez ?
Merci
A+



