Sign in to follow this  
Followers 0
sunlord

Having a "browse" button in a GUI?

10 posts in this topic

Using the Koda form designer how do you get a Browse button next to an Input box so that you can "browse" for a file and when you select the file and click ok the filename of that file is put into the input box?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Now, Does the Autoit can be interact with server that was written in other language, lets say Java?.

Are you talking about something like FileSelectFolder()? That would get the path and put it in an input?

EDIT: Misunderstood question, sorry.

Edited by BALA

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

It's a regular button, that triggers a FileOpenDialog. The return of the FileOpenDialog is then read into the Input control (make sure you check for @error on the FileOpenDialog).

Edited by Manadar

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Browse Button Example", 303, 141, 193, 115)
$Input1 = GUICtrlCreateInput("", 21, 19, 201, 21)
$Button1 = GUICtrlCreateButton("Browse...", 235, 16, 64, 25, 0)
$Group1 = GUICtrlCreateGroup("Browse what", 20, 44, 279, 63)
$Radio1 = GUICtrlCreateRadio("Folder", 26, 60, 113, 17)
$Radio2 = GUICtrlCreateRadio("File to open", 26, 74, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("Exit", 166, 111, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("i542 ", 0, 0, 27, 17, -1, $GUI_WS_EX_PARENTDRAG)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Button2
            Exit
        Case $nMsg = $Button1
            If GuiCtrlRead($Radio1) = $GUI_CHECKED Then
                $txt=FileSelectFolder( "Open", "C:\")
                GUICtrlSetData($Input1,$txt)
            ElseIf GuiCtrlRead($Radio2) = $GUI_CHECKED Then
                $txt=FileOpenDialog("Open", "C:\","Text files (*.txt)")
                GUICtrlSetData($Input1,$txt)
            Else
                MsgBox(64,"Browse button example","You must select something.")
            EndIf
    EndSelect
WEnd

Sony Ericsson T290i and J210i owner. :whistle:

i542

Edited by i542
1 person likes this

I can do signature me.

Share this post


Link to post
Share on other sites

Thank you very much i542.

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Browse Button Example", 303, 141, 193, 115)
$Input1 = GUICtrlCreateInput("", 21, 19, 201, 21)
$Button1 = GUICtrlCreateButton("Browse...", 235, 16, 64, 25, 0)
$Group1 = GUICtrlCreateGroup("Browse what", 20, 44, 279, 63)
$Radio1 = GUICtrlCreateRadio("Folder", 26, 60, 113, 17)
$Radio2 = GUICtrlCreateRadio("File to open", 26, 74, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button2 = GUICtrlCreateButton("Exit", 166, 111, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("i542 ", 0, 0, 27, 17, -1, $GUI_WS_EX_PARENTDRAG)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE Or $nMsg = $Button2
            Exit
        Case $nMsg = $Button1
            If GuiCtrlRead($Radio1) = $GUI_CHECKED Then
                $txt=FileSelectFolder( "Open", "C:\")
                GUICtrlSetData($Input1,$txt)
            ElseIf GuiCtrlRead($Radio2) = $GUI_CHECKED Then
                $txt=FileOpenDialog("Open", "C:\","Text files (*.txt)")
                GUICtrlSetData($Input1,$txt)
            Else
                MsgBox(64,"Browse button example","You must select something.")
            EndIf
    EndSelect
WEnd
Sony Ericsson T290i and J210i owner. :whistle:

i542

 

Thanks alot for the help! 

Was able to make something with this that worked for me <3

Share this post


Link to post
Share on other sites

Srex,

You do realise that the post above yours dates from over 7 years ago? In future please do not resurrect threads from this far back. :naughty:

M23


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

#9 ·  Posted (edited)

Yes but it still helped me and just wanted to thank him.

Well okay sorry didn't try to do something bad. :(

Edited by Srex

Share this post


Link to post
Share on other sites

Yes but it still helped me and just wanted to thank him.

Well okay sorry didn't try to do something bad. :(

 

I believe clicking the "Like This" button will do the trick and won't resurrect such an ancient topic.

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