Merci de me répondre.
Cordialement JIF,
Code : Tout sélectionner
#include <Date.au3>
; Variable à ecrire dans le fichier texte
Local $currentDate = _DateTimeFormat( _NowCalc(), 2)
Local $currentTime = _DateTimeFormat( _NowCalc(), 5)
Local $variable = 125
;~ filename Filename of the text file to open.
;~ mode Mode (read or write) to open the file in.
;~ Can be a combination of the following:
;~ 0 = Read mode
;~ 1 = Write mode (append to end of file)
;~ 2 = Write mode (erase previous contents)
;~ 4 = Read raw mode
;~ 8 = Create directory structure if it doesn't exist (See Remarks).
;~ 16 = Force binary(byte) reading and writing mode with FileRead and FileWrite
;~ 32 = Use Unicode UTF16 Little Endian reading and writing mode. Reading does not override existing BOM
;~ 64 = Use Unicode UTF16 Big Endian reading and writing mode. Reading does not override existing BOM
;~ 128 = Use Unicode UTF8 reading and writing mode. Reading does not override existing BOM
;~ Both write modes will create the file if it does not already exist. The folder path must already exist (except using mode '8' - See Remarks).
Local $filename = @ScriptDir&"\log\logfile.txt"
Local $mode = 10 ; 2 + 8 (erase + create dir)
Local $file = FileOpen($filename, $mode)
; Ecriture dans le fichier texte
FileWriteLine($file,"")
FileWriteLine($file," ___________________")
FileWriteLine($file,"| |")
FileWriteLine($file,"| DEBUT log |")
FileWriteLine($file,"|___________________|")
FileWriteLine($file,"")
FileWriteLine($file,"")
FileWriteLine($file," Informations générales")
FileWriteLine($file," ------------------------")
FileWriteLine($file," -> Début du traitement lancé le "&$currentDate&" à "&$currentTime)
FileWriteLine($file," -> $variable = "&$variable)
; Ouverture du fichier log avec notepad
Run("notepad.exe "&$filename)