Je construis une application permettant la modification des dates des fichiers.
Malheureusement je rencontre 2 difficultés :
- le format de l'heure retournée par GUICtrlCreateDate, est en 12H : je souhaiterais la transformer en 24H et faire figurer les secondes

- le texte du champ Date n'est pas centré.

Auriez-vous des pistes pour résoudre ce problème ?
Merci par avance pour vos lumières ...
Voici le code en question :
Code : Tout sélectionner
#include <DateTimeConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <string.au3>
#include <Date.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
; Datemodif
$version = "1.0"
$colorbleu = 0x003366 ;Bleu foncé
$colorblanc = 0xFFFFFF ;blanc
$colorge = 0xFF0000 ;rouge
$allong = 100
Global $Gui = GUICreate("Datemodif " & $version, 500 + $allong, 110, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST))
GUICtrlCreatePic(".\ocean.jpg", 0, 0, 500 + $allong, 110, 0)
;
; Date sélectionnée
$labdate = GUICtrlCreateLabel("Date :", 20, 70, 200, 30)
GUICtrlSetBkColor($labdate, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($labdate, $colorbleu)
GUICtrlSetFont($labdate, 12, 800)
Local $Date = GUICtrlCreateDate("", 110, 70, 250 + $allong, 30)
_DateTimeFormat ( $Date, 5 )
Local $sStyle = "yyyyMMdd hh:mm:ss"
GUICtrlSendMsg($Date, $DTM_SETFORMATW, 0, $sStyle)
GUICtrlSetFont($Date, 10, 400)
GUICtrlSetFont($Date, 12, 800)
; Chemin du fichier à traiter
$labfich = GUICtrlCreateLabel("Fichier :", 20, 20, 200, 30, $SS_LEFT)
GUICtrlSetBkColor($labfich, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($labfich, $colorbleu)
GUICtrlSetFont($labfich, 12, 800)
Global $Chem = GUICtrlCreateInput("", 110, 10, 250 + $allong, 30)
GUICtrlSetState($Chem, BitOR($GUI_DROPACCEPTED, $GUI_FOCUS, $GUI_ACCEPTFILES))
GUICtrlSetColor($Chem, $colorbleu)
GUICtrlSetFont($Chem, 10, 800)
$cree = GUICtrlCreateCheckbox("Créé", 190, 50, 12, 12)
$mod = GUICtrlCreateCheckbox("Modifié", 290, 50, 12, 12)
$acc = GUICtrlCreateCheckbox("Accédé", 390, 50, 12, 12)
$labcree = GUICtrlCreateLabel("Créé", 160, 50, 40, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, $colorbleu)
$labmod = GUICtrlCreateLabel("Modifié", 250, 50, 40, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, $colorbleu)
$labacc = GUICtrlCreateLabel("Accédé", 345, 50, 40, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, $colorbleu)
; Bouton de démarrage
$Start = GUICtrlCreateButton("Lancer", 400 + $allong, 30, 60, 50)
GUICtrlSetBkColor($Start, $colorbleu)
GUICtrlSetColor($Start, $colorblanc)
GUICtrlSetFont($Start, 11, 800)
GUISetState(@SW_SHOW, $Gui)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ;fermeture de l'application
Exit
EndIf
If $msg = $Start Then
Go()
MsgBox(262144, "Info", "Date(s) modifiée(s)", 3)
EndIf
WEnd
; Fonctions
Func Go()
$Lectchem = GUICtrlRead($Chem)
$lectdate = GUICtrlRead($Date)
; transformation des dates dans le fichier
Local $sStyle = "yyyyMMdd hh:mm:ss"
If GUICtrlRead($mod) = $GUI_CHECKED Then
$iFileSetTime = FileSetTime($Lectchem, $lectdate, 0)
Sleep(30)
EndIf
If GUICtrlRead($cree) = $GUI_CHECKED Then
$iFileSetTime = FileSetTime($Lectchem, $lectdate, 1)
Sleep(30)
EndIf
If GUICtrlRead($acc) = $GUI_CHECKED Then
$iFileSetTime = FileSetTime($Lectchem, $lectdate, 2)
Sleep(30)
EndIf
EndFunc ;==>Go