Sign in to follow this  
Followers 0
kor

how do you put file path into an input after a user clicks open?

3 posts in this topic

I'm trying to replicate the functionality of having an input that you can either type a file path in... or click a browse button and it opens a fileopen dialog. Then once you select the file to open, it puts the path into that input.

What is this method called?

Share this post


Link to post
Share on other sites



Ok here is one way to do it

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 211, 67, 388, 177)
$Input1 = GUICtrlCreateInput("", 8, 8, 193, 21)
$Button1 = GUICtrlCreateButton("Browse", 8, 32, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $path=FileOpenDialog("Select File",@ScriptDir,"All(*.*)")
            GUICtrlSetData($Input1,$path)
    EndSwitch
WEnd

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