Jump to content

Open File : ComboBox


Recommended Posts

Hey,

Well... I want to have this ComboBox, with a button below it. I want it so that the button is the "excecute" button. Depending on what is selected in the ComboBox, a file will open...

I looked around and found how to do it with buttons, but while attempting to apply it with a ComboBox, I failed.

(I did look at the topic below, but it didn't appear to have my answer)

#include <GUIConstants.au3>
$Form1 = GUICreate("Select File", 240, 150, 0, 0)
$Button1 = GUICtrlCreateButton("Run File", 75, 80, 75, 25)
$Combo1 = GUICtrlCreateCombo("", 32, 24, 145, 21)
GUICtrlSetData(-1, "Doc1|Doc2|Doc3|Doc4|Doc5|Doc6","Doc1")
GUISetState(@SW_SHOW)



While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;
EndSelect
WEnd
Exit

So pretty much, I want each selection in the ComboBox to have it's own designated file path, and when the excecute button is clicked, the file will open.

---Thanks :P

Link to comment
Share on other sites

maybe like this

#include <GUIConstants.au3>
$Form1 = GUICreate("Select File", 240, 150, 0, 0)
$Button1 = GUICtrlCreateButton("Run File", 75, 80, 75, 25)
$Combo1 = GUICtrlCreateCombo("", 32, 24, 145, 21)
GUICtrlSetData(-1, "Doc1|Doc2|Doc3|Doc4|Doc5|Doc6","Doc1")
GUISetState(@SW_SHOW)



While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button1
    $doc = GUICtrlRead($Combo1)
    if $doc = "Doc1" then Run("notepad.exe")
; if.... bla... bla
;
EndSelect
WEnd
Exit

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...