Jump to content
Sign in to follow this  
GoronSlayer99

Open File : ComboBox

Recommended Posts

GoronSlayer99

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

  • Like 1

Share this post


Link to post
Share on other sites
Valuater

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)

  • Like 1

NEWHeader1.png

Share this post


Link to post
Share on other sites
GoronSlayer99

:P:lmao::(

Yeah, that works perfectly, thanks man.

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  

×