Sign in to follow this  
Followers 0
Clark

FileOpenDialog create issue

2 posts in this topic

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

Share this post


Link to post
Share on other sites



Try to use FileSaveDialog instead FileOpenDialog in the second part ! Posted Image

#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.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0