Jump to content

File select


Recommended Posts

Hi,

Please see below my code, what I am trying to do is when clicking on "brows" then selecting a folder and clicking "OK" I want the path to be copied into "File path" input box.

Any sugestions on how I can do this?

Thanks in advance.

#include <GuiConstants.au3>
Opt ("GUIOnEventMode", 1)
Global $MyForm_Form 
$MyForm_Form = GUICreate("Select folder file",300,200,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
$Lable = GuiCtrlCreateLabel("File path:", 10, 100, 100, 20)
$input = GuiCtrlCreateInput("", 120, 100, 100, 20)
$Brows = GUICtrlCreateButton("Brows", 230, 100, 60, 20)
GUICtrlSetOnEvent($Brows,"_brows")
$cancel = GUICtrlCreateButton("Cancel", 170, 150, 120, 40)
GUICtrlSetOnEvent($cancel,"_cancel")

While 1
    
WEnd

Func _brows()
    $brows = FileSelectFolder("Choose a folder.", "",4)
EndFunc

Func _cancel()
    Exit
EndFunc
Link to comment
Share on other sites

After the line with FileSelectFolder on it, add this :

If NOT @error Then GUICtrlSetData($input, $brows)oÝ÷ Øpʬ¥v·uÖ­|ç©|¨ºµ¡W¿XIÝ)¶«zò¢ì"WâÚ.¶ØZ¶Ø^õ.±¨mç(ë/z¼¡jº^
Usually a tight loop like the one shown would send the CPU to 100% - fortunately the GUIGetMsg function

automatically idles the CPU when there are no events waiting.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...