[..] Script Rendez-vous

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

[..] Script Rendez-vous

#1

Message par Shade »

Bonjour,

Je me permet de poster car je rencontre un souci.
Je cherche à créer un script qui me permet de gérer mes rendez-vous!
Par exemple dans ma GUI j'inscris le nom, le prénom, l'adresse, etc... du client, ensuite je choisis le motif dans une checkbox et j'aimerai enregistrer le tout dans un fichier excel comment puis-je faire?

Merci de vos réponses.

Cordialement Shade.
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#2

Message par Zippo »

Peut-être que l'UDF Excel peut vous aidez.
http://www.autoitscript.com/forum/topic ... elcom-udf/

J'ai aussi une question, est-ce que il faut 1 fichier excel pour 1 RDV ou un seul pour tout les RDV ?
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#3

Message par Shade »

Non un fichier par rendez-vous, si c'est possible.
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#4

Message par Zippo »

Aucun problème. Je mis met de ce pas.
Je pourrais connaître les Motifs ou alors je vous laisse avec la fonction.
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#5

Message par Shade »

Laissé la fonction et vous m'expliquerai comment en ajouter comme ça je pourrais comprendre le fonctionnement :)
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#6

Message par Shade »

Je vous passe ma GUI si vous voulez

► Afficher le texte
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#7

Message par Zippo »

Voilà une fonction que je vous propose.

Code : Tout sélectionner

#include <Excel.au3>

_Create_Fichier_Client("X","Mr","10 rue saint glinglin","Rencontre","23/03/2011","PremierFichier")

Func _Create_Fichier_Client($_nom,$_prenom,$_addresse,$_motif,$_date,$_Fichier)
Local $oExcel = _ExcelBookNew(0);=> 0 = invisible
_ExcelWriteCell($oExcel, "Nom :", 1, 1)
_ExcelWriteCell($oExcel, $_nom, 1, 2)
_ExcelWriteCell($oExcel, "Prenom :", 2, 1)
_ExcelWriteCell($oExcel, $_prenom, 2, 2)
_ExcelWriteCell($oExcel, "Addresse :", 3, 1)
_ExcelWriteCell($oExcel, $_addresse, 3, 2)
_ExcelWriteCell($oExcel, "Motif :", 4, 1)
_ExcelWriteCell($oExcel, $_motif, 4, 2)
_ExcelWriteCell($oExcel, "Date :", 5, 1)
_ExcelWriteCell($oExcel, $_date, 5, 2)
_ExcelBookSaveAs($oExcel, @ScriptDir & "\"&$_Fichier&".xls")
_ExcelBookClose($oExcel)
EndFunc
Il y a surment plus simple ^^', mais c'est ce qu'il me vient a l'esprit.
J'espère vous avoir aidé. Si vous avez une question, n'hésitez pas.
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#8

Message par Shade »

Merci beaucoup et est ce que je peux l'intégrer dans ma gui que je vous ai fourni au dessus?
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#9

Message par Zippo »

Bien-sure. Il faut juste ajouté des _ExcelWriteCell() & des variables dans la fonction.
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#10

Message par Shade »

Oula,là je suis totalement perdu...

Pourriez-vous me le faire ou pas?

Car la je viens d'essayer et au lieu que ça m'affiche le nom, j'ai un neméro :shock:
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#11

Message par Zippo »

J'y travaille déjà ;)
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#12

Message par Shade »

Merci :D
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#13

Message par Shade »

Tu ne galères pas trop Zippo?
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#14

Message par Zippo »

Code : Tout sélectionner

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <excel.au3>

;Début de l'interface graphique;
Global $Form1_1 = GUICreate("Prise de rendez-vous", 633, 525, 192, 124)
Global $Fichier = GUICtrlCreateMenu("&Fichier")
Global $Sauvegarder = GUICtrlCreateMenuItem("Sauvegarder", $Fichier)
Global $Client = GUICtrlCreateGroup("Client", 8, 16, 289, 313)
Global $Nom = GUICtrlCreateLabel("Nom", 32, 56, 26, 17)
Global $Prenom = GUICtrlCreateLabel("Prénom", 32, 96, 40, 17)
Global $Adresse = GUICtrlCreateLabel("Adresse", 32, 136, 42, 17)
Global $CP = GUICtrlCreateLabel("CP", 32, 208, 18, 17)
Global $Ville = GUICtrlCreateLabel("Ville", 32, 248, 23, 17)
Global $Telephone = GUICtrlCreateLabel("Téléphone", 32, 288, 55, 17)
Global $Input1 = GUICtrlCreateInput("", 104, 56, 121, 21)
Global $Input2 = GUICtrlCreateInput("", 104, 96, 121, 21)
Global $Input3 = GUICtrlCreateInput("", 104, 136, 185, 50)
Global $Input4 = GUICtrlCreateInput("", 104, 208, 121, 21)
Global $Input5 = GUICtrlCreateInput("", 104, 248, 121, 21)
Global $Input6 = GUICtrlCreateInput("", 104, 288, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Evenements = GUICtrlCreateGroup("Evènements", 320, 16, 257, 273)
Global $Combo1 = GUICtrlCreateCombo("", 408, 88, 145, 25)
GUICtrlSetData(-1, "Mariage|Baptême|Sports|Studio")
Global $Types = GUICtrlCreateLabel("Types", 336, 88, 33, 17)
Global $Options = GUICtrlCreateLabel("Options", 336, 136, 40, 17)
Global $Preparation = GUICtrlCreateCheckbox("Préparation", 408, 136, 97, 17)
Global $Mairie = GUICtrlCreateCheckbox("Mairie", 408, 160, 97, 17)
Global $Eglise = GUICtrlCreateCheckbox("Eglise", 408, 184, 97, 17)
Global $Photos_couple = GUICtrlCreateCheckbox("Photos couple", 408, 208, 97, 17)
Global $Vin = GUICtrlCreateCheckbox("Vin", 408, 232, 97, 17)
Global $Soiree = GUICtrlCreateCheckbox("Soirée", 408, 256, 97, 17)
Global $Date = GUICtrlCreateLabel("Date", 336, 48, 27, 17)
Global $Input7 = GUICtrlCreateInput("", 408, 48, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Remarques = GUICtrlCreateGroup("Remarques", 320, 304, 257, 97)
Global $Input8 = GUICtrlCreateInput("", 328, 328, 241, 60)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Sauvegarde = GUICtrlCreateButton("Sauvegarder", 72, 344, 171, 25, $WS_GROUP)
Global $Quitte = GUICtrlCreateButton("Quitter", 72, 384, 171, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
;Fin de l'interface graphique;

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Sauvegarde
            _verif_Gui(GUICtrlRead($Input1),GUICtrlRead($Input2),GUICtrlRead($Input3),GUICtrlRead($Input4),GUICtrlRead($Input5),GUICtrlRead($Input6),GUICtrlRead($Input7),GUICtrlRead($Input8),GUICtrlRead($Combo1),GUICtrlRead($Preparation),GUICtrlRead($Mairie),GUICtrlRead($Eglise),GUICtrlRead($Photos_couple),GUICtrlRead($Vin),GUICtrlRead($Soiree))
        Case $Quitte
            Exit
        Case $Sauvegarder
            _verif_Gui(GUICtrlRead($Input1),GUICtrlRead($Input2),GUICtrlRead($Input3),GUICtrlRead($Input4),GUICtrlRead($Input5),GUICtrlRead($Input6),GUICtrlRead($Input7),GUICtrlRead($Input8),GUICtrlRead($Combo1),GUICtrlRead($Preparation),GUICtrlRead($Mairie),GUICtrlRead($Eglise),GUICtrlRead($Photos_couple),GUICtrlRead($Vin),GUICtrlRead($Soiree))

 EndSwitch
WEnd

Func _verif_Gui($_nom,$_prenom,$_addresse,$_CP,$_Ville,$_Tel,$_Date,$_Remarques,$_Type,$_Preparation,$_Mairie,$_Eglise,$_Photos_couple,$_Vin,$_Soiree)
    Local $Options
    If $_nom= "" OR $_prenom= "" OR $_addresse= "" OR $_CP= "" OR $_Ville= "" OR $_Tel= "" OR $_Date= "" OR $_Remarques= "" OR $_Type = "" Then
        MsgBox(0,"Erreur","Un ou plusieurs champ(s) ne son pas remplit.")
        Return 0
    EndIf

    If $_Preparation = "1" Then
        $Options &= "Preparation|"
    EndIf
    If $_Mairie = "1" Then
        $Options &= "Mairie|"
    EndIf
    If $_Eglise = "1" Then
        $Options &= "Eglise|"
    EndIf
    If $_Photos_couple = "1" Then
        $Options &= "Photos Couple"
    EndIf
    If $_Vin = "1" Then
        $Options &= "Vin|"
    EndIf
    If $_Soiree = "1" Then
        $Options &= "Soirée"
    EndIf

    _Create_Fichier_Client($_nom,$_prenom,$_addresse,$_CP,$_Ville,$_Tel,$_Date,$_Type,$Options,$_Remarques)

EndFunc


Func _Create_Fichier_Client($_nom,$_prenom,$_addresse,$_CP,$_Ville,$_Tel,$_Date,$_Type,$Options,$_Remarques)
Local $oExcel = _ExcelBookNew(0),$_Fichier = $_nom,$i = 0
_ExcelWriteCell($oExcel, "Nom :", 1, 1)
_ExcelWriteCell($oExcel, $_nom, 1, 2)
_ExcelWriteCell($oExcel, "Prenom :", 2, 1)
_ExcelWriteCell($oExcel, $_prenom, 2, 2)
_ExcelWriteCell($oExcel, "Addresse :", 3, 1)
_ExcelWriteCell($oExcel, $_addresse, 3, 2)
_ExcelWriteCell($oExcel, "CP :", 4, 1)
_ExcelWriteCell($oExcel, $_CP, 4, 2)
_ExcelWriteCell($oExcel, "Ville :", 5, 1)
_ExcelWriteCell($oExcel, $_Ville, 5, 2)
_ExcelWriteCell($oExcel, "Téléphone :", 6, 1)
_ExcelWriteCell($oExcel, $_Tel, 6, 2)
_ExcelWriteCell($oExcel, "Date :", 7, 1)
_ExcelWriteCell($oExcel, $_Date, 7, 2)
_ExcelWriteCell($oExcel, "Types :", 8, 1)
_ExcelWriteCell($oExcel, $_Type, 8, 2)
_ExcelWriteCell($oExcel, "Options :", 9, 1)
_ExcelWriteCell($oExcel, $Options, 9, 2)
_ExcelWriteCell($oExcel, "Remarques :", 10, 1)
_ExcelWriteCell($oExcel, $_Remarques, 10, 2)

$f = _ExcelBookSaveAs($oExcel, @ScriptDir & "\"&$_Fichier&".xls")

if @error Then
    While 1
        $i = $i + 1
        $f = _ExcelBookSaveAs($oExcel, @ScriptDir & "\"&$_Fichier&"("&$i&").xls")
        If $f = 1 Then ExitLoop
    WEnd
EndIf

_ExcelBookClose($oExcel)
EndFunc
Voilà. Si il y a un bug Post le moi ;).
Ps : Désolé pour les fautes d'orthographes mais je suis assez nul de ce côté & Aussi désolé pour le temps que j'ai mis ^^' mais il m'a fallut retaper toutes les variables^^.
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#15

Message par Shade »

No souci, je te remercie, tu me sauves la vie, tu es mon héros :mrgreen:
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#16

Message par Zippo »

De rien l'ami ! ;)
Je le rédit car il y avait 2 erreurs au niveau des options.

Code : Tout sélectionner

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <excel.au3>

;Début de l'interface graphique;
Global $Form1_1 = GUICreate("Prise de rendez-vous", 633, 525, 192, 124)
Global $Fichier = GUICtrlCreateMenu("&Fichier")
Global $Sauvegarder = GUICtrlCreateMenuItem("Sauvegarder", $Fichier)
Global $Client = GUICtrlCreateGroup("Client", 8, 16, 289, 313)
Global $Nom = GUICtrlCreateLabel("Nom", 32, 56, 26, 17)
Global $Prenom = GUICtrlCreateLabel("Prénom", 32, 96, 40, 17)
Global $Adresse = GUICtrlCreateLabel("Adresse", 32, 136, 42, 17)
Global $CP = GUICtrlCreateLabel("CP", 32, 208, 18, 17)
Global $Ville = GUICtrlCreateLabel("Ville", 32, 248, 23, 17)
Global $Telephone = GUICtrlCreateLabel("Téléphone", 32, 288, 55, 17)
Global $Input1 = GUICtrlCreateInput("", 104, 56, 121, 21)
Global $Input2 = GUICtrlCreateInput("", 104, 96, 121, 21)
Global $Input3 = GUICtrlCreateInput("", 104, 136, 185, 50)
Global $Input4 = GUICtrlCreateInput("", 104, 208, 121, 21)
Global $Input5 = GUICtrlCreateInput("", 104, 248, 121, 21)
Global $Input6 = GUICtrlCreateInput("", 104, 288, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Evenements = GUICtrlCreateGroup("Evènements", 320, 16, 257, 273)
Global $Combo1 = GUICtrlCreateCombo("", 408, 88, 145, 25)
GUICtrlSetData(-1, "Mariage|Baptême|Sports|Studio")
Global $Types = GUICtrlCreateLabel("Types", 336, 88, 33, 17)
Global $Options = GUICtrlCreateLabel("Options", 336, 136, 40, 17)
Global $Preparation = GUICtrlCreateCheckbox("Préparation", 408, 136, 97, 17)
Global $Mairie = GUICtrlCreateCheckbox("Mairie", 408, 160, 97, 17)
Global $Eglise = GUICtrlCreateCheckbox("Eglise", 408, 184, 97, 17)
Global $Photos_couple = GUICtrlCreateCheckbox("Photos couple", 408, 208, 97, 17)
Global $Vin = GUICtrlCreateCheckbox("Vin", 408, 232, 97, 17)
Global $Soiree = GUICtrlCreateCheckbox("Soirée", 408, 256, 97, 17)
Global $Date = GUICtrlCreateLabel("Date", 336, 48, 27, 17)
Global $Input7 = GUICtrlCreateInput("", 408, 48, 121, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Remarques = GUICtrlCreateGroup("Remarques", 320, 304, 257, 97)
Global $Input8 = GUICtrlCreateInput("", 328, 328, 241, 60)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Sauvegarde = GUICtrlCreateButton("Sauvegarder", 72, 344, 171, 25, $WS_GROUP)
Global $Quitte = GUICtrlCreateButton("Quitter", 72, 384, 171, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
;Fin de l'interface graphique;

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Sauvegarde
            _verif_Gui(GUICtrlRead($Input1),GUICtrlRead($Input2),GUICtrlRead($Input3),GUICtrlRead($Input4),GUICtrlRead($Input5),GUICtrlRead($Input6),GUICtrlRead($Input7),GUICtrlRead($Input8),GUICtrlRead($Combo1),GUICtrlRead($Preparation),GUICtrlRead($Mairie),GUICtrlRead($Eglise),GUICtrlRead($Photos_couple),GUICtrlRead($Vin),GUICtrlRead($Soiree))
        Case $Quitte
            Exit
        Case $Sauvegarder
            _verif_Gui(GUICtrlRead($Input1),GUICtrlRead($Input2),GUICtrlRead($Input3),GUICtrlRead($Input4),GUICtrlRead($Input5),GUICtrlRead($Input6),GUICtrlRead($Input7),GUICtrlRead($Input8),GUICtrlRead($Combo1),GUICtrlRead($Preparation),GUICtrlRead($Mairie),GUICtrlRead($Eglise),GUICtrlRead($Photos_couple),GUICtrlRead($Vin),GUICtrlRead($Soiree))

 EndSwitch
WEnd

Func _verif_Gui($_nom,$_prenom,$_addresse,$_CP,$_Ville,$_Tel,$_Date,$_Remarques,$_Type,$_Preparation,$_Mairie,$_Eglise,$_Photos_couple,$_Vin,$_Soiree)
    Local $Options
    If $_nom= "" OR $_prenom= "" OR $_addresse= "" OR $_CP= "" OR $_Ville= "" OR $_Tel= "" OR $_Date= "" OR $_Remarques= "" OR $_Type = "" Then
        MsgBox(0,"Erreur","Un ou plusieurs champ(s) ne son pas remplit.")
        Return 0
    EndIf

    If $_Preparation = "1" Then
        $Options &= "Preparation|"
    EndIf
    If $_Mairie = "1" Then
        $Options &= "Mairie|"
    EndIf
    If $_Eglise = "1" Then
        $Options &= "Eglise|"
    EndIf
    If $_Photos_couple = "1" Then
        $Options &= "Photos Couple|"
    EndIf
    If $_Vin = "1" Then
        $Options &= "Vin|"
    EndIf
    If $_Soiree = "1" Then
        $Options &= "Soirée|"
    EndIf

    _Create_Fichier_Client($_nom,$_prenom,$_addresse,$_CP,$_Ville,$_Tel,$_Date,$_Type,$Options,$_Remarques)

EndFunc


Func _Create_Fichier_Client($_nom,$_prenom,$_addresse,$_CP,$_Ville,$_Tel,$_Date,$_Type,$Options,$_Remarques)
Local $oExcel = _ExcelBookNew(0),$_Fichier = $_nom,$i = 0
_ExcelWriteCell($oExcel, "Nom :", 1, 1)
_ExcelWriteCell($oExcel, $_nom, 1, 2)
_ExcelWriteCell($oExcel, "Prenom :", 2, 1)
_ExcelWriteCell($oExcel, $_prenom, 2, 2)
_ExcelWriteCell($oExcel, "Addresse :", 3, 1)
_ExcelWriteCell($oExcel, $_addresse, 3, 2)
_ExcelWriteCell($oExcel, "CP :", 4, 1)
_ExcelWriteCell($oExcel, $_CP, 4, 2)
_ExcelWriteCell($oExcel, "Ville :", 5, 1)
_ExcelWriteCell($oExcel, $_Ville, 5, 2)
_ExcelWriteCell($oExcel, "Téléphone :", 6, 1)
_ExcelWriteCell($oExcel, $_Tel, 6, 2)
_ExcelWriteCell($oExcel, "Date :", 7, 1)
_ExcelWriteCell($oExcel, $_Date, 7, 2)
_ExcelWriteCell($oExcel, "Types :", 8, 1)
_ExcelWriteCell($oExcel, $_Type, 8, 2)
_ExcelWriteCell($oExcel, "Options :", 9, 1)
_ExcelWriteCell($oExcel, $Options, 9, 2)
_ExcelWriteCell($oExcel, "Remarques :", 10, 1)
_ExcelWriteCell($oExcel, $_Remarques, 10, 2)

$f = _ExcelBookSaveAs($oExcel, @ScriptDir & "\"&$_Fichier&".xls")

if @error Then
    While 1
        $i = $i + 1
        $f = _ExcelBookSaveAs($oExcel, @ScriptDir & "\"&$_Fichier&"("&$i&").xls")
        If $f = 1 Then ExitLoop
    WEnd
EndIf

_ExcelBookClose($oExcel)
EndFunc
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#17

Message par Shade »

est-ce possible de mettre les options les unes en dessous des autres ou pas?
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#18

Message par Zippo »

Hum...Peut-être, je vais faire des tests. Jte tiens au courrant.
Shade
Niveau 4
Niveau 4
Messages : 74
Enregistré le : mar. 16 nov. 2010 13:32
Status : Hors ligne

Re: [..] Script Rendez-vous

#19

Message par Shade »

Ok merci :D
Avatar du membre
Zippo
Niveau 6
Niveau 6
Messages : 243
Enregistré le : mar. 30 nov. 2010 12:50
Status : Hors ligne

Re: [..] Script Rendez-vous

#20

Message par Zippo »

► Afficher le texte
Voilà :)
Répondre