J'ai un petit problème. (Non non, pas dans ma plantation
En effet, j'utilise FileOpenDialog afin que l'utilisateur puisse lui-même donner un nom au fichier...
J'ai mis comme option : $FD_PROMPTOVERWRITE => afin d'avoir une demande de confirmation d'écrasement du fichier, si existant...
L'aide dit bien ceci :
De là, je vais voir donc l'include FileConstants.au3, qui me dit ceci :FileOpenDialog ( "title", "init dir", "filter" [, options = 0 [, "default name" [, hwnd]]] )
(...)
options [optional] Dialog Options: To use more than one option, BitOR the required values together.
$FD_FILEMUSTEXIST (1) = File Must Exist (if user types a filename)
$FD_PATHMUSTEXIST (2) = Path Must Exist (if user types a path, ending with a backslash)
$FD_MULTISELECT (4) = Allow MultiSelect
$FD_PROMPTCREATENEW (8) = Prompt to Create New File (if does not exist)
Constants are defined in FileConstants.au3
; Indicates file open and save dialog options
Global Const $FD_FILEMUSTEXIST = 1 ; File must exist
Global Const $FD_PATHMUSTEXIST = 2 ; Path must exist
Global Const $FD_MULTISELECT = 4 ; Allow multi-select
Global Const $FD_PROMPTCREATENEW = 8 ; Prompt to create new file
Global Const $FD_PROMPTOVERWRITE = 16 ; Prompt to overWrite file
Voici le code en question :
Code : Tout sélectionner
local $line[3]
$line[1]="ligne n°1"
$line[2]="ligne n°2"
$FileOD = FileOpenDialog("Enregistrer sous...",@DesktopDir,"Fichier texte (*.txt)",$FD_PROMPTOVERWRITE,"lignes.txt")
;~ $FileOD = FileOpenDialog("Enregistrer sous...",@DesktopDir,"Fichier texte (*.txt)",16,"lignes.txt")
for $i=1 to 3
FileWriteLine($FileOD,$line[$i])
Next
ShellExecute($FileOD)J'espérais que ce code réduit fonctionne au poil... Je me suis trompé.
Donc l'erreur provient d'AutoIt ou de moi-même (ce que je pense ^^)
Bref, voici le souci :
~~ Je n'ai pas de fenêtre me demandant si je veux écraser ou non le fichier... Alors que le fichier existe bel et bien.
Y'a-t-il une âme charitable pouvant éclairer ma p'tite lanterne ?
Merci
@ bientôt !


