Clipper34 Posted June 4, 2008 Posted June 4, 2008 (edited) Hey guys, recently i got back to using AutoIt. And ive came across with a problem with FileSaveDialog and FileOpenDialog. The problem is the file or the file saved wont appear. I'm assuming its a problem with the filter given, here's an example: $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" While 1 $saveOption = InputBox("", "Do you wish to be asked to overwrite files? (yes/no): ") If $saveOption = "yes" OR $saveOption = "no" Then ExitLoop Else MsgBox(0, "", "Choose your option please: ") EndIf WEnd If $saveOption = "yes" Then $saveOption = 16 Else $saveOption = "" EndIf $file = FileSaveDialog("Save Dialouge", $MyDocsFolder, "Text files(*.txt)", 16) $exitoption = InputBox("Options?", "Do you want to exit or open a folder? (yes/no): ") If @error Then MsgBox(4096, "ERROR", "No File(s) typed") Else $var = StringReplace($var, "|", @CRLF) MsgBox(4096, "Selection", "You chose " & $var) EndIf if $exitoption = "yes" OR $exitoption = "no" Then Else MsgBox(0, "Choose", "Choose your option please: ") EndIf If $exitoption = "yes" Then FileOpenDialog(0, "Save Dialouge/Open", $MyDocsFolder, "", 12) EndIf Edited June 4, 2008 by Clipper34
enaiman Posted June 4, 2008 Posted June 4, 2008 I guess you are assuming that FileSaveDialog will create the file for you if the file doesn't exist or it will actually save that file. Well, FileSaveDialog will return a handle to that "virtual" file; if you don't specifically create a file, open it and close it then nothing will appear there. I remember that some time ago I've been assuming the same thing and I thought the same ... dunno, maybe an entry should be added to help file to warn the user that the file isn't actually created by this. Another suggestion: try to use @MyDocumentsDir macro instead of "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" Try this script $var = FileSaveDialog( "Choose a name.", @MyDocumentsDir, "Text (*.txt)", 2) ; option 2 = dialog remains until valid path/file selected If @error Then MsgBox(4096,"","Save cancelled.") Else MsgBox(4096,"","You chose " & $var) EndIf If FileExists($var) Then MsgBox(0, "Found", $var) Else MsgBox(0, "Not Found", $var&" doesn't exist") EndIf MsgBox(0, "Test", "Now will perform a file open/close and recheck") FileOpen($var, 2) ;open in mode 2 ;you may write something to the file here FileClose($var) ;close the file If FileExists($var) Then MsgBox(0, "Found (after creating file)", $var) Else MsgBox(0, "Not Found (after creating file)", $var&" doesn't exist") EndIf It will show you exactly what is happening. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now