Jump to content

FileOpenDialog and FileSelectFolder


Recommended Posts


I'm trying to:

-Select a file in a folder (to store it to an ini file)

-Write the file on an ini

-Copy files to the folder selected by the user

instead of using FileOpenDialog then FileSelectFolder, I was wondering if it was possible to do the whole thing only with FileOpenDialog spliting the value returned in 2 variables. I got something like that for the first part (select a file and store it to an ini file)

Local $message = "Select your executable"
                        Local $pathk = FileOpenDialog($message, "C:" & "", "Select the executable you want to terminate (*.exe)", 1 + 4)

                        Local $path = "None"
;ici je dois copier les fichiers

                        $split = StringSplit($pathk, "\")
                        $tokill = $split[$split[0]]

                        If @error Then
                        MsgBox(4096, "", "No Executable chosen")

                        MsgBox(4096, "", $pathk & " Will be terminated " & @LF & @LF & "Press OK to EXIT ")
                        IniWrite(@ScriptDir & "\path.ini", "Torun", "path", $path)
                        IniWrite(@ScriptDir & "\path.ini", "Tokill", "pathk", $tokill)

As you can see I manage to split the value returned by FileOpenDialog to have only the exe but as a noob I can't manage to get the path to copy the files I need to the same path.

Any idea? ^^

Link to comment
Share on other sites

There are bunch of path API functions here: "C:\Program Files (x86)\AutoIt3\Include\WinAPIShPath.au3" 

Simple code:

Func GetPath($sFullPath)
    Local $i = StringInStr($sFullPath,'\',1,-1) ; first backslah from end
    If $i = 0 Then Return $sFullPath
    Return StringLeft($sFullPath, $i)


Link to comment
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

  • Create New...