Sign in to follow this  
Followers 0
Mark01

Help updating and Input

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Mark01,

Welcome to the AutoIt forum. :graduated:

No need to use GUICtrlRead: :D

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.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Mark01,

Welcome to the AutoIt forum. :graduated:

No need to use GUICtrlRead: :D

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

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