Re: [..] Comment programmé un bouton
Posté : jeu. 12 mai 2011 17:45
Tu n'as pas lu ma réponse. Donc, c'est normal, ça ne marche pas!
Communauté Francophone AutoIt
https://autoitscript.fr/forum/
tu par de full path ?? je sais pas se que sais xDricky a écrit :Grillé par Yarillo, mais je suis pas daccord avec toi.
Il faut mettre le full path avant le skype, voir documentation.
Code : Tout sélectionner
Run(@ProgramFilesDir&"\Skype\Skype.exe", @ProgramFilesDir&"\Skype")Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\eminem\bureau\trainer.kxf
$trainer = GUICreate("trainer", 124, 48, 479, 308)
GUISetBkColor(0xF1EFE2)
$Starte = GUICtrlCreateButton("Start ", 32, 8, 57, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Starte
Run(@ProgramFilesDir&"\Skype\Skype.exe", @ProgramFilesDir&"\Skype")
Exit
EndSwitch
WEnd
Oh là là, dur dur de ce répéter...ricky a écrit :Edit : de plus, Yarillo a donné la réponse à 11h54 ce matin.
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\eminem\bureau\trainer.kxf
$trainer = GUICreate("trainer", 124, 48, 479, 308)
GUISetBkColor(0xF1EFE2)
$Starte = GUICtrlCreateButton("Start ", 32, 8, 57, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Starte
Run(@ProgramFilesDir&"\Skype\Skype.exe", @ProgramFilesDir&"\Skype")
If @error Then
MsgBox(0,"Erreur", "Skype est introuvable, le chemin est certainement erroné")
Else
Exit
EndIf
EndSwitch
WEndCode : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\eminem\bureau\trainer.kxf
$trainer = GUICreate("trainer", 124, 48, 479, 308)
GUISetBkColor(0xF1EFE2)
$Starte = GUICtrlCreateButton("Start ", 32, 8, 57, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Starte
Run(@ProgramFilesDir&"\Skype\Phone\Skype.exe", @ProgramFilesDir&"\Skype")
If @error Then
MsgBox(0,"Erreur", "Skype est introuvable, le chemin est certainement erroné")
Else
Exit
EndIf
EndSwitch
WEndCode : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\eminem\bureau\trainer.kxf
$trainer = GUICreate("trainer", 124, 48, 479, 308)
GUISetBkColor(0xF1EFE2)
$Starte = GUICtrlCreateButton("Start ", 32, 8, 57, 25, 0)
GUICtrlSetFont(-1, 8, 800, 0, "@Arial Unicode MS")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$contextmenu = GUICtrlCreateContextMenu($Starte)
$choisir = GUICtrlCreateMenuItem("Choisir", $contextmenu)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $chemin=""
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $choisir
Local $chemin = FileOpenDialog("Choisir le fichier exe de Skype", "C:\", "Exécutable (*.exe)", 1)
If Not FileExists($chemin) Then
$chemin = ""
Else
MsgBox(0, "Skype", "Vous avez choisi le chemin :"&@CRLF&"'"&$chemin&"'")
EndIf
Case $Starte
If $chemin = "" Then
MsgBox(0, "Erreur", "Skype n'est pas connu, fais un clic droit sur le bouton Start pour choisir")
Else
Run($chemin)
If @error Then
MsgBox(0,"Erreur", "Skype est introuvable, le chemin est certainement erroné")
EndIf
EndIf
EndSwitch
WEnd