Clark Posted May 3, 2011 Share Posted May 3, 2011 Hi all The following code is meant to open a file for reading, and open (or create) a file for writing. #include <File.au3> $message = "Please select a file to convert" $initialDir = "W:\Testing\Tools\Diehard" $var = FileOpenDialog($message, $initialDir & "\", "All (*.*)", 1 ) If @error Then MsgBox(4096,"","No File(s) chosen") exit Else $var = StringReplace($var, "|", @CRLF) MsgBox(4096,"","You chose " & $var) EndIf $message="Please select a file to write to" $var = FileOpenDialog($message, $initialDir & "\", "All (*.*)", 1 + 8 ) If @error Then MsgBox(4096,"","No File(s) chosen") exit Else $var = StringReplace($var, "|", @CRLF) MsgBox(4096,"","You chose " & $var) EndIf What seems to happen is the final dialog lets me enter a file name to create, the msgbox says I have selected the file I want to create, but looking in the directory there is no file there. What am I missing here? TIA Link to comment Share on other sites More sharing options...
wakillon Posted May 3, 2011 Share Posted May 3, 2011 Try to use FileSaveDialog instead FileOpenDialog in the second part ! #Include <File.au3> Global $_FileSaveDialog, $_FileOpen, $_FilePath = @DesktopDir & '\TextFile.txt' _FileCreate ( $_FilePath ) $_FileSaveDialog = FileSaveDialog ( "Select File", @DesktopDir, "Text (*.txt)", 2 + 16 ) ConsoleWrite ( "$_FileSaveDialog : " & $_FileSaveDialog & @Crlf ) FileCopy ( $_FilePath, $_FileSaveDialog ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
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