Voici mon code, j'ai essayé de le compiler sur Windows 2000 et XP et le problème est le même.
Symptomes :
- Processexists ne marche pas
- Si on presse configurer sans sélectionner de bouton il prend la valeur de $RECComA
- Si on presse sur un bouton radio et sur configurer, la msgbox ne vient pas et l'application ne bouge pas
- Le filecopy ne marche
► Afficher le textecode
Code : Tout sélectionner
;$Date: 2010-10-25 14:46:38 +0200 (lun. 25 oct. 2010) $
;$Revision: 21 $
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: RC
Script Function:
Configuration du DCN
#ce ----------------------------------------------------------------------------
;Déclarations
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
; Déclrations de variables
Global $iniFile = @WindowsDir & "\DCN.ini" ; Fichier ini du DCN
Global $iniBackup = @WindowsDir & "\DCN_" & _NowCalcDate() & ".ini" ; Backup du fichier ini
Global $DCNCom, $RECComA, $RECComB, $comRecorder = "0"
Global $titleWindow = "DCN configuration"
changelog() ; Affichage du change log
; Contrôle si le programme est arrêté
If ProcessExists("stg.exe") Then
_ErrorMsg("DCN Startup est ouvert, il faut le fermer avant de lancer ce programme.")
Exit
EndIf
If FileExists($iniFile) Then
FileCopy($iniFile, $iniBackup, 1) ; Création d'une sauvegarde du fichier ini
$DCNCom = IniRead($iniFile, "Serial Link", "ComPort", "NotFound") ; Récupération de la config client
; Test s'il y a une erreur du port COM
If Not StringIsDigit($DCNCom) Then
_ErrorMsg("Le port com du CCU n'est pas configure correctement.")
Exit
EndIf
; Affectation des valeurs de COM possibles
If $DCNCom = "1" Or $DCNCom = "3" Then
$RECComA = "2"
$RECComB = "4"
ElseIf $DCNCom = "2" Or $DCNCom = "4" Then
$RECComA = "1"
$RECComB = "3"
Else
_ErrorMsg("Le port com du CCU n'est pas configure correctement. Com = 0 ou > 4.")
Exit
EndIf
AffichageMenu()
Else
_ErrorMsg("DCN.ini pas présent dans " & @WindowsDir & ".")
Exit
EndIf
Func AffichageMenu()
#region ### START Koda GUI section ### Form=U:\Programmation\trunk\Form1.kxf
GUICreate($titleWindow, 211, 131, 192, 124)
GUICtrlCreateGroup("Configuration", 10, 40, 190, 55)
Global $Radio1 = GUICtrlCreateRadio("Com " & $RECComA, 140, 50, 55, 20)
Global $Radio2 = GUICtrlCreateRadio("Com " & $RECComB, 140, 70, 55, 20)
GUICtrlCreateLabel("Port pour le Recorder : ", 25, 60, 110, 17, $SS_CENTERIMAGE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("Port com du CCU : ", 10, 15, 95, 17, $SS_CENTERIMAGE)
Global $ConfigButton = GUICtrlCreateButton("Configurer", 20, 100, 75, 25, $WS_GROUP)
GUICtrlCreateLabel($DCNCom, 105, 15, 36, 17, $SS_CENTERIMAGE)
Global $ExitButton = GUICtrlCreateButton("Quitter", 115, 100, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio1 And BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED
$comRecorder = $RECComA
Case $Radio2 And BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED
$comRecorder = $RECComB
Case $ConfigButton
MsgBox(0, "test", $comRecorder)
If $comRecorder = "0" Then
_ErrorMsg("Valeur du port com pour le Recorder incorrecte.")
Else
CheckIni()
EndIf
Case $ExitButton
Exit
EndSwitch
WEnd
EndFunc ;==>AffichageMenu
Func CheckIni() ; Contrôle si le fichier ini est qu'en lecture
$attrib = FileGetAttrib($iniFile)
$result = StringInStr($attrib, "R")
If $result > 0 Then
If Not FileSetAttrib($iniFile, "-R") Then
_ErrorMsg("Fichier en lecture seule, impossible de le modifier.")
EndIf
EndIf
ConfigIni()
MsgBox(64, "DCN Config", "Configuration du DCN reussie.")
Exit
EndFunc ;==>CheckIni
Func ConfigIni()
; Configuration de la partie Database
IniWrite($iniFile, "Database", "ViewScreenLine", "Yes")
IniWrite($iniFile, "Database", "ViewCard", "No")
; Configuration de la section de trasnmission au Recorder
IniDelete($iniFile, "MicActLogging")
IniWrite($iniFile, "MicActLogging", "LOG_PRT", "Yes")
IniWrite($iniFile, "MicActLogging", "LOG_AUX", "Yes")
IniWrite($iniFile, "MicActLogging", "PrtPort", $comRecorder)
EndFunc ;==>ConfigIni
Func _ErrorMsg($message, $time = 0)
MsgBox(48 + 262144, "Error!", $message, $time)
EndFunc ;==>_ErrorMsg
Func changelog() ; Affichage du changelog
If $cmdline[0] > 0 Then
Switch $cmdline[1]
Case "changelog", "-changelog", "/changelog"
FileInstall("changelog.txt", @TempDir & "\changelog.txt", 1)
ShellExecuteWait("notepad.exe", @TempDir & "\changelog.txt", "", "open")
FileDelete(@TempDir & "\changelog.txt")
Exit
Case Else
_ErrorMsg("Parameter : " & $cmdline[1] & " not found.")
Exit
EndSwitch
EndIf
EndFunc ;==>changelogMerci d'avance pour votre aide, si vous eavez des remarques, n'hésitez pas. Ou si vous voyez des optimisations, dites-le moi...

