Voici un formualire surlequel je suis entrain de travailler
je souhaiterais pouvoir effacer la saisie de tous les champs lorsque l'on clique sur annuler
la fonction GUICtrlDelete n'est pas adaptée car elle suprime complétement l'élément ...
réinitialiser la valeur ne fonctionne pas ... j'en deduis donc qu'il doit exister une autre fonction ...
Merci d'avance pour vos conseils ! Jean-Marc
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
Local $Name,$Vorname,$Pole1,$Fonction1,$TELFIXE1,$TELMOB1,$FAX1,$EMAIL1
; Détection de l'OS
If @OSVersion = "WIN_XP" Then
$path = "\Application Data\Microsoft\Signatures\"
$chemin = @UserProfileDir & $path
Else
$path = "\AppData\Roaming\Microsoft\Signatures\"
$chemin = @UserProfileDir & $path
EndIf
; Vérification existence du dossier Signatures ou Création pour les personnes n'ayant pas encore crée de Signature
If FileExists($chemin) = 1 Then
;~ msgbox(64,"Dossier Signatures Existe"," Dossier existe")
Else
DirCreate($chemin)
;~ msgbox(64,"Dossier Signatures inexistant","Dossier créer")
EndIf
If @Error Then
msgbox(48,"Vous avez rencontré une erreur","Contacter votre administrateur")
EndIf
; Gestion du timeOut
$timeout=_IELoadWaitTimeout(60000)
if $timeout=1 Then
Else
msgbox(48,"Temps d'accés trop longs - Site inaccessible "," Veuilliez contacter votre administrateur")
EndIf
; Configuration du niveau de sécurité internet explorer
;~ Local $domain = "xxxxxx/signature"
;~ RegWrite ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\" & $domain, "http", "REG_DWORD", 2)
;connexion au site web les paramètres 0,0,0 permettent de cacher l'execution
;Local $oIE = _IECreate("xxxxxx/signature", 0, 0, 0)
;connexion au site web sans les paramètres 0,0,0 permettent de d'afficher l'execution
Local $oIE = _IECreate("xxxxxx/signature",0,0,0)
; Fenêtre de saisie du nom
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Outil de création de Signature Outlook", 480, 392, 192, 114)
$Group1 = GUICtrlCreateGroup("Création Signature Outlook", 8, 8, 449, 369)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Nom", 32, 56, 58, 25)
$Input1 = GUICtrlCreateInput("Saisir votre nom", 152, 56, 257, 32)
$Label2 = GUICtrlCreateLabel("Prenom", 32, 88, 80, 25)
$Input2 = GUICtrlCreateInput("Saisir votre prénom", 152, 88, 257, 32)
$Label3 = GUICtrlCreateLabel("Pôle", 32, 120, 57, 25)
$Input3 = GUICtrlCreateInput("Saisir votre Pôle", 152, 120, 257, 32)
$Label4 = GUICtrlCreateLabel("Tél fixe", 32, 152, 70, 25)
$Input4 = GUICtrlCreateInput("Saisir votre N° de Tél Fixe", 152, 152, 257, 32)
$Label5 = GUICtrlCreateLabel("Tél Portable", 32, 184, 101, 33)
$Input5 = GUICtrlCreateInput("Saisir N° Tél Portable", 152, 184, 257, 32)
$Label6 = GUICtrlCreateLabel("Fax", 32, 216, 77, 25)
$Input6 = GUICtrlCreateInput("Saisir N° Fax", 152, 216, 257, 32)
$Label7 = GUICtrlCreateLabel("Email", 32, 248, 53, 25)
$Input7 = GUICtrlCreateInput("Saisir Email", 152, 248, 257, 32)
$Button1 = GUICtrlCreateButton("Valider", 200, 304, 81, 33)
$Button2 = GUICtrlCreateButton("Annuler", 280, 304, 81, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
case $Button1
Msgbox (64,"Recapitulatif"," Vous avez saisi votre nom : " & guictrlread($Input1)&@CRLF& "Vous avez saisi votre Prénom : " & guictrlread($Input2) & @CRLF & "Vous avez saisi votre Pôle d'appartenance : "& guictrlread($Input3) & @CRLF &"Vous avez saisi votre N° de Tél Fixe : "& guictrlread($Input4) & @CRLF &"Vous avez saisi votre N° de Tél Portable : "& guictrlread($Input5) & @CRLF &" Vous avez saisi votre N° de Fax : "& guictrlread($Input6) & @CRLF &"Vous avez saisi votre Email : "& guictrlread($Input7))
case $Button2
$test=msgbox(6,"Annulation saisie"," Les données saisies seront supprimées"& $MB_CANCELTRYCONTINUE)
Switch $test
case $test=2
msgbox(48,"Annuler",$test)
GUICtrlDelete($Input1)
case $test=10
msgbox(64,"Recommencer",$test)
case $test=11
msgbox(64,"Continuer",$test)
EndSwitch
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
$nom = _IEGetObjByName($oIE, "Nom")
_IEPropertySet($Input1, "innertext", $Name)
; Test de saisie du Nom
While $Name = ''
MsgBox(48, " Champ Nom à saisir ", "Ce champ est obligatoire")
Local $Name = InputBox("Signature -> NOM Champ impératif", " Veuilliez saisir votre NOM")
WEnd
; Fenêtre de saisie Obligatoire du Prenom
$prenom = _IEGetObjByName($oIE, "Prenom")
_IEPropertySet($prenom, "innertext", $Vorname)
; Test de saisie obligatoire du Prénom
While $Vorname = ''
MsgBox(48, " Champ Nom à saisir ", "Ce champ est obligatoire")
Local $prenom = InputBox("Signature -> * PRENOM Champ impératif", " Veuilliez saisir votre PRENOM")
WEnd
; Fenêtre de saisie Obligatoire du Pôle
$Pole = _IEGetObjByName($oIE, "Service")
_IEPropertySet($Pole, "innertext", $Pole1)
; Test de saisie Obligatoire du Pôle
While $Pole = ''
MsgBox(48, " Champ Pole à saisir ", "Ce champ est obligatoire")
Local $Name = InputBox("Signature -> * Pôle Champ impératif", " Veuilliez saisir votre Pôle d'appartenace")
WEnd
; Fenetre de saisie facultative de la Fonction
$Pole = _IEGetObjByName($oIE, "Fonction")
_IEPropertySet($Pole, "innertext", $Fonction1)
; Test de saisie facultatif de la fonction
If $Fonction1 = ' ' Then
MsgBox(48, " Champ Fonction à saisir ", "Ce champ est facultatif")
Local $Fonction1 = InputBox("Signature -> Fonction -> Champ Facultatif", " Veuilliez saisir votre Fonction")
EndIf
;Fenêtre de saisie obligatoire Télé Fixe
$TEL = _IEGetObjByName($oIE, "Tel")
_IEPropertySet($TEL, "innertext", $TELFIXE1)
While $TELFIXE1 = ''
MsgBox(48, " Champ N° Téléphone Fixe à saisir ", "Ce champ est obligatoire")
WEnd
;Fenêtre de saisie facultative Télé mobile
$TELMOB = _IEGetObjByName($oIE, "Mobile")
_IEPropertySet($TELMOB, "innertext", $TELMOB1)
; Fenêtre de saisie facultative Fax
$FAX = _IEGetObjByName($oIE, "Fax")
_IEPropertySet($FAX, "innertext", $FAX1)
; Fenêtre de saisie obligatoire Email pro
$EMAIL = _IEGetObjById($oIE, "email")
_IEPropertySet($EMAIL, "innertext", $EMAIL1)
; Test de saisie obligatoire Adresse Email
While $EMAIL = ''
MsgBox(64, " Champ Signature -> * Adresse Email ", "Ce champ est obligatoire")
WEnd
; Fenetre de saisie obligatoire Campagne ou non
Local $campagne_form = MsgBox(4, "Champ Signature avec Campagne -> * Création Signature avec Campagne", " La réponse à ce champ est obligatoire")
If $campagne_form = "6" Then
Local $oForm = _IEFormGetObjByName($oIE, "form")
Local $oQuery = _IEFormElementGetObjByName($oForm, "campagne")
_IEFormElementCheckBoxSelect($oForm, 0, "", 1, "byIndex")
Sleep(2000)
EndIf
; Fenetre de saisie obligatoire adresse
Local $adresse_form = MsgBox(4, "Champ Signature avec Addresse -> * Création signature avec adresse", " La réponse à ce champ est facultative")
If $adresse_form = "6" Then
Local $oForm = _IEFormGetObjByName($oIE, "form")
Local $oQuery = _IEFormElementGetObjByName($oForm, "adresse")
_IEFormElementCheckBoxSelect($oForm, 1, "", 1, "byIndex")
Sleep(2000)
EndIf
; validation du formulaire
$oSubmit = _IEGetObjByName($oIE, "submit")
_IEAction($oSubmit, "click")
; affichage dans la console afin de debugger la connexion au site
Local $url = ""
While $url <> "http://xxxxx/signature/image.php"
$url = $oIE.document.url
ConsoleWrite($url & @CRLF)
Sleep(1000)
WEnd
; si accès ok affiche Url OK
ConsoleWrite("Url ok")
$oSubmit = _IEGetObjById($oIE, "bonton2")
_IEAction($oSubmit, "click")
;enregistrement du fichier
Func enregistrer()
SplashTextOn("Enregistrement en cours", "Ne pas appuyer sur le clavier avant le message de fin.", 200, 300, 250, 250, 4, "", 24)
WinWaitActive("Téléchargement de fichier", "")
Sleep(1500)
ControlClick("Téléchargement de fichier", " ", "[CLASS:Button; INSTANCE:2]", "left")
Sleep(1500)
WinWait("Enregistrer sous", "")
;copier dans le dossier destination
; Clique sur CONTROL
Send("{CTRLDOWN}")
Sleep(1000)
; Clique sur le C, qui fait le Copier
Send("c")
Sleep(1000)
; Relache le CONTROL
Send("{CTRLUP}")
Sleep(1000)
Sleep(2500)
Send($chemin)
Sleep(1000)
;coller
Send("{CTRLDOWN}")
Sleep(1000)
Send("v")
Sleep(1000)
Send("{CTRLUP}")
Sleep(1000)
Send("{ENTER}")
WinWaitActive("Téléchargement terminé", "")
Send("{TAB 3}")
Send("{ENTER}")
Sleep(1000)
SplashOff()
EndFunc ;==>enregistrer
enregistrer()
Local $oIE3 = _IECreate("xxxxx/signature/image.php", 1)
$oSubmit3 = _IEGetObjByName($oIE3, "send_html")
_IEAction($oSubmit3, "click")
enregistrer()
; vérifier existence des fichiers _iereadhtml expression régulière
;$lecture=_IEBodyReadHTML($oIE)
;msgbox(64,"Lecture","Titre",$lecture)
MsgBox(64, " Copie des fichiers achevée ", " Merci de votre patience", 5)
Exit