communication entre un script et une base de donnée

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Répondre
yohanb767
Niveau 5
Niveau 5
Messages : 117
Enregistré le : mer. 28 déc. 2016 14:09
Status : Hors ligne

communication entre un script et une base de donnée

#1

Message par yohanb767 »

Bonjour à tous !

j'aurai besoin d'une solution pour mon script (je suis débutant) j'ai écris un script pour une saisie automatique dans une page SAP (pour ce qui connaissent)
le soucis c'est que dans mon script j'ai inséré des numéros de code articles qui je pense changerons pour certain dans l'avenir
ma question est

est-il possible de mettre dans un fichier excel ou autre ces numéros de code articles afin de ne pas avoir à changer directement le script

Yohan

voici le script en question

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>

If WinActive("Gestion des avis de réception: écran principal") Then

BlockInput (1)
MouseClick("left", 270, 337, 1, 0)
MouseClick("left", 290, 337, 1, 0)
MouseClick("left", 415, 424, 2, 10)
Send ("^c")
Local $sdevis = ClipGet() ; On récupère les données par le presse papier
Sleep(300)
BlockInput (0)
;------PANNE--------


Switch $sdevis

Case "293555594","189432200","188626142","188451235","293555586","188602981","189379677","260438026","293577280","188379264","251366131","251722610","188603003","188626246","188451194","189379586","251725364","293568538"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("Sous-Ensemble", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#EndRegion #
BlockInput (0)

Case "293644502","293537306","293557824","252664565"
BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("BE / BS", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#EndRegion #
BlockInput (0)

Case "293669484","0101","0103","000","0102","293678777"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)

Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("MESTA", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#EndRegion #
BlockInput (0)

Case "293525281","293551281","293662328","186281507","293559641","191609976","186281630","186209295","192066576"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)

Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("FFR", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#EndRegion #
BlockInput (0)

Case "188603024","189432263","293563955","293548812","188400233","189388168","189719219"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("FLASH", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#EndRegion #
BlockInput (0)

Case "293594893","293600261","293621489","293601276","293601284","293601383","293605162","293605328","293599559","192066576"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 8}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("VM", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#Region #
BlockInput (0)

Case "293684572"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 8}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("VM", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#Region #
BlockInput (0)

Case "260562872","293575640","260562913","293582702","293567924","293682479","293579432"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
BlockInput (0)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("AUCUN", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#Region #
BlockInput (0)

Case "189416967","189602039","192004943","189416967"

BlockInput (1)
Send ( "!{F4}")
;Symptômes client
Send("{TAB 20}")
Mouseclick ("left", 120, 488, 1, 1)
Send ("AA05")
;Fact Nfac
Send("{TAB 10}")
Send ("FACT")
;Destination
Send("{TAB 2}")
Send ("RETOUR EXPEDITEUR")
;Direction
Send("{TAB 2}")
Send ("REPARATION SIMPLE")
;Précision
Mouseclick ("left", 190, 579, 1, 1)
Mouseclick ("left", 211, 578, 1, 1)
;Devis
Mouseclick ("left", 84, 278, 1, 5)
Mouseclick ("left", 117, 278, 1, 5)
Mouseclick ("left", 225, 311, 2, 5)
Opt("GUIOnEventMode", 1)
#Region #
$Form1_1 = GUICreate("", 258, 211, 383, 222)
$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
 GUICtrlSetOnEvent($idValider, "Valider")
$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
 GUICtrlSetOnEvent($idAnnuler, "Annuler")
$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$Label5 = GUICtrlCreateLabel("AUCUN", 48, 112, 152, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#Region #
BlockInput (0)

EndSwitch

Send ("{RIGHT}")
Send ("{LEFT}")
WinSetOnTop ( "Form1", "", 1 )

Else
    Exit
EndIf

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

Func Valider()
Mouseclick ("left", 233, 52, 2, 0);Enregistrer

 WinWait("Gestion des avis de réception: écran initial")
    WinActivate("Edition des FIT")

Exit
 EndFunc   ;==>Valider

Func Annuler()
Exit
 EndFunc   ;==>Annuler
Modifié en dernier par mikell le dim. 15 oct. 2017 09:02, modifié 1 fois.
Raison : balises de code
Avatar du membre
TomAijerrie
Niveau 5
Niveau 5
Messages : 192
Enregistré le : lun. 02 juin 2014 09:55
Localisation : Lyon
Status : Hors ligne

Re: communication entre un script et une base de donnée  

#2

Message par TomAijerrie »

Bonjour,

Je te propose de mettre tous tes codes dans un fichier ini.

J'ai modifié ton code et créé le fichier ini.

Pour le code, j'ai pas trop chercher à modifier de peur de tout casser, même si il a besoin d'être optimisé.

Code : Tout sélectionner

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>

If WinActive("Gestion des avis de réception: écran principal") Then
	BlockInput (1)
	MouseClick("left", 270, 337, 1, 0)
	MouseClick("left", 290, 337, 1, 0)
	MouseClick("left", 415, 424, 2, 10)
	Send ("^c")
	Local $sdevis = ClipGet() ; On récupère les données par le presse papier
	Sleep(300)
	BlockInput (0)
	;------PANNE--------


	Switch IniRead(@ScriptDir & "\codes.ini",$sdevis,"Action",0)
		Case 0
			MsgBox(0,"Erreur","Le code du produit n'est pas répertorié")
			Exit
		Case 1 ;Action = 1
			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("Sous-Ensemble", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#EndRegion #
			BlockInput (0)

		Case 2 ;Action = 2
			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("BE / BS", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#EndRegion #
			BlockInput (0)

		Case 3 ; Action = 3

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)

			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("MESTA", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#EndRegion #
			BlockInput (0)

		Case 4 ; Action = 4

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)

			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("FFR", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#EndRegion #
			BlockInput (0)

		Case 5 ; Action = 5

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("FLASH", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#EndRegion #
			BlockInput (0)

		Case 6

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 8}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("VM", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#Region #
			BlockInput (0)

		Case 7

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 8}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("VM", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#Region #
			BlockInput (0)

		Case 8

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			BlockInput (0)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("AUCUN", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#Region #
			BlockInput (0)

		Case 9

			BlockInput (1)
			Send ( "!{F4}")
			;Symptômes client
			Send("{TAB 20}")
			Mouseclick ("left", 120, 488, 1, 1)
			Send ("AA05")
			;Fact Nfac
			Send("{TAB 10}")
			Send ("FACT")
			;Destination
			Send("{TAB 2}")
			Send ("RETOUR EXPEDITEUR")
			;Direction
			Send("{TAB 2}")
			Send ("REPARATION SIMPLE")
			;Précision
			Mouseclick ("left", 190, 579, 1, 1)
			Mouseclick ("left", 211, 578, 1, 1)
			;Devis
			Mouseclick ("left", 84, 278, 1, 5)
			Mouseclick ("left", 117, 278, 1, 5)
			Mouseclick ("left", 225, 311, 2, 5)
			Opt("GUIOnEventMode", 1)
			#Region #
			$Form1_1 = GUICreate("", 258, 211, 383, 222)
			$Label1 = GUICtrlCreateLabel("", 48, 16, 4, 4)
			$Label2 = GUICtrlCreateLabel("", 16, 56, 4, 4)
			$idValider = GUICtrlCreateButton("Valider", 24, 168, 97, 25)
			GUICtrlSetOnEvent($idValider, "Valider")
			$idAnnuler = GUICtrlCreateButton("Annuler", 136, 168, 97, 25)
			GUICtrlSetOnEvent($idAnnuler, "Annuler")
			$Group1 = GUICtrlCreateGroup("Joindre avec le Produit le devis", 24, 88, 209, 57)
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			$Group2 = GUICtrlCreateGroup("vous avez choisi le symptôme ", 24, 16, 209, 57)
			$Label4 = GUICtrlCreateLabel("- ou Autre", 50, 32, 168, 33)
			GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
			GUICtrlCreateGroup("", -99, -99, 1, 1)
			GUISetState(@SW_SHOW)
			$Label5 = GUICtrlCreateLabel("AUCUN", 48, 112, 152, 28)
			GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
			#Region #
			BlockInput (0)

	EndSwitch
			
	Send ("{RIGHT}")
	Send ("{LEFT}")
	WinSetOnTop ( "Form1", "", 1 )
Else
	Exit
EndIf

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch
WEnd

Func Valider()
	Mouseclick ("left", 233, 52, 2, 0);Enregistrer

	WinWait("Gestion des avis de réception: écran initial")
	WinActivate("Edition des FIT")

	Exit
EndFunc ;==>Valider

Func Annuler()
	Exit
EndFunc ;==>Annuler
Le fichier ini, Comme nom de section je met le code (jsp à quoi il correspond) et il n'y a qu'une clef appelée Action, qui contient un numéro (Tu pourras modifier) qui correspond à l'action qu'il doit faire.
Il faut enregistrer ce fichier dans le même dossier du script et l’appeler codes.ini

Code : Tout sélectionner

[293555594]
Action=1
[189432200]
Action=1
[188626142]
Action=1
[188451235]
Action=1
[293555586]
Action=1
[188602981]
Action=1
[189379677]
Action=1
[260438026]
Action=1
[293577280]
Action=1
[188379264]
Action=1
[251366131]
Action=1
[251722610]
Action=1
[188603003]
Action=1
[188626246]
Action=1
[188451194]
Action=1
[189379586]
Action=1
[251725364]
Action=1
[293568538]
Action=1

[293644502]
Action=2
[293537306]
Action=2
[293557824]
Action=2
[252664565]
Action=2

[293669484]
Action=3
[0101]
Action=3
[0103]
Action=3
[000]
Action=3
[0102]
Action=3
[293678777]
Action=3

[293525281]
Action=4
[293551281]
Action=4
[293662328]
Action=4
[186281507]
Action=4
[293559641]
Action=4
[191609976]
Action=4
[186281630]
Action=4
[186209295]
Action=4
[192066576]
Action=4

[188603024]
Action=5
[189432263]
Action=5
[293563955]
Action=5
[293548812]
Action=5
[188400233]
Action=5
[189388168]
Action=5
[189719219]
Action=5

[293594893]
Action=6
[293600261]
Action=6
[293621489]
Action=6
[293601276]
Action=6
[293601284]
Action=6
[293601383]
Action=6
[293605162]
Action=6
[293605328]
Action=6
[293599559]
Action=6
[192066576]
Action=6

[293684572]
Action=7

[260562872]
Action=8
[293575640]
Action=8
[260562913]
Action=8
[293582702]
Action=8
[293567924]
Action=8
[293682479]
Action=8
[293579432]
Action=8

[189416967]
Action=9
[189602039]
Action=9
[192004943]
Action=9
[189416967]
Action=9
yohanb767
Niveau 5
Niveau 5
Messages : 117
Enregistré le : mer. 28 déc. 2016 14:09
Status : Hors ligne

Re: communication entre un script et une base de donnée

#3

Message par yohanb767 »

Merci beaucoup Tomaijerrie !!

content d'en apprendre tous les jours grâce à des personnes comme toi
je vais maintenant comme tu as dis essayer de l'optimiser

merci encore
Répondre