Sign in to follow this  
Followers 0
craigholohan

File select

3 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks a million Helge,

Also thanks for the advice about the While/WEnd-loop.

Cheers,

Craig

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