Mark01 Posted November 24, 2010 Share Posted November 24, 2010 Please help me. I need to be able to browse a directory and then once I select the directory it will update the $USB_path line. Here's my code so far #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=\\bp1xtxap110\wave$\Inbox\Win7\USMT\Scripts\AutoIT\Forms\Voyager_USB.kxf Global $Msg, $Cancel_Button, $OK_Button, $Form1_1_1, $Help_Button, $TargetInputView Global $Pic1, $OldPC, $NewPC, $USB_Path, $Browse_Btn, $varFolder, $USB_Input Opt('MustDeclareVars', 1) _Voy_USB() Func _Voy_USB() $Form1_1_1 = GUICreate("Scan PC", 471, 327, 397, 200) GUISetIcon("C:\Users\Public\Pictures\test.ico") GUISetBkColor(0xD4D0C8) $OK_Button = GUICtrlCreateButton("&OK", 78, 272, 75, 29, $WS_GROUP) $Cancel_Button = GUICtrlCreateButton("&Cancel", 190, 272, 75, 29, $WS_GROUP) $Help_Button = GUICtrlCreateButton("&Help", 320, 272, 75, 29, $WS_GROUP) $Pic1 = GUICtrlCreatePic("C:\Users\test\Documents\SnagIt\test.jpg", 104, 8, 284, 76, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) $OldPC = GUICtrlCreateButton("OldPC", 104, 176, 123, 57, $WS_GROUP) $NewPC = GUICtrlCreateButton("NewPC", 272, 176, 123, 57, $WS_GROUP) $USB_Path = GUICtrlCreateInput("", 104, 128, 121, 21) $Browse_Btn = GUICtrlCreateButton("Browse", 248, 128, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 ;After every loop check if the user clicked something in the GUI window $Msg = GUIGetMsg() Select ;Check if user clicked on the close button Case $Msg = $GUI_EVENT_CLOSE ;Destroy the GUI including the controls GUIDelete() ;Exit the script Exit ;Check if user clicked on the "OK" button Case $Msg = $OK_Button MsgBox(64, "Ready to Begin", "You clicked on the OK button!") ;Check if user clicked on the "CANCEL" button Case $Msg = $Cancel_Button MsgBox(64, "Quit!", "You clicked on the Cancel button!") Exit Case $Msg = $Browse_Btn Browse_Fld() Case $Msg = $OldPC Scan_Old() Case $Msg = $NewPC Load_New() EndSelect WEnd EndFunc ;==>_Voy_USB Func Browse_Fld() $varFolder = FileSelectFolder("Choose a folder.", "c:\") $USB_Input = GUICtrlRead($varFolder) GUICtrlSetData($USB_Path, $USB_Input) EndFunc ;==>Browse_Fld Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 24, 2010 Moderators Share Posted November 24, 2010 (edited) Mark01,Welcome to the AutoIt forum. No need to use GUICtrlRead: Func Browse_Fld() $varFolder = FileSelectFolder("Choose a folder.", "c:\") GUICtrlSetData($USB_Path, $varFolder) EndFunc ;==>Browse_FldM23P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. Edit: Added welcome. Edited November 24, 2010 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mark01 Posted November 24, 2010 Author Share Posted November 24, 2010 Mark01, Welcome to the AutoIt forum. No need to use GUICtrlRead: Func Browse_Fld() $varFolder = FileSelectFolder("Choose a folder.", "c:\") GUICtrlSetData($USB_Path, $varFolder) EndFunc ;==>Browse_Fld M23 P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. Edit: Added welcome. Thanks Melba23 that worked MN Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now