ermilemerson Posted June 30, 2009 Posted June 30, 2009 Guys, I need help I am being asked to make a gui with inputbox and browse button Here is what I need to do Whenever I press browse button and open a txt file, the path must be indicated in the input path and output path inputboxes And whenever I enter a path in the input path input box, it must be displayed on the ouput box. Hope someone can help me, I will be very thankful. #include <GUIConstants.au3> main() Func main() GUICreate(" Filter Results", 387, 200, @DesktopWidth / 2 - 260, @DesktopHeight / 2 - 45) $filter = GUICtrlCreateButton("Filter", 125, 170,100, 23) GUICtrlCreateLabel("**Input Path**", 150, 35) $path = GUICtrlCreateInput("",10,53,367,23) $browse = GUICtrlCreateButton("Browse File", 135, 81,100, 23) GUICtrlCreateLabel("**Output Path**", 148, 111) $output = GUICtrlCreateInput("",10, 128,367,23) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $browse FileOpenDialog ("Browse", "C:\", "Text Documents (*.txt)") EndSelect WEnd EndFunc
enaiman Posted June 30, 2009 Posted June 30, 2009 You have to use the value returned by FileOpenDialog (file+path) to update the content of the inputboxes. Have a look at my additions. #include <GUIConstants.au3> main() Func main() GUICreate(" Filter Results", 387, 200, @DesktopWidth / 2 - 260, @DesktopHeight / 2 - 45) $filter = GUICtrlCreateButton("Filter", 125, 170,100, 23) GUICtrlCreateLabel("**Input Path**", 150, 35) $path = GUICtrlCreateInput("",10,53,367,23) $browse = GUICtrlCreateButton("Browse File", 135, 81,100, 23) GUICtrlCreateLabel("**Output Path**", 148, 111) $output = GUICtrlCreateInput("",10, 128,367,23) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $browse $File2open = FileOpenDialog ("Browse", "C:\", "Text Documents (*.txt)") ;returns the file path GUICtrlSetData($path, $File2open) ;set input data GUICtrlSetData($output, $File2open) ;same as above EndSelect WEnd EndFunc AutoIt help file is your best friend SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
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