Jump to content

Combo Box Help


Recommended Posts

  • Developers

Something like:

While 1
    $MainMsg = GUIGetMsg()
    Select
        Case $MainMsg = $GUI_EVENT_CLOSE
            Exit
        Case $MainMsg = $Button1;Calculator
            If GUIctrlread($Combo_1) = "Notepad" then Run("notepad.exe")        
            If GUIctrlread($Combo_1) = "Calculator" then Run("calc.exe")    
    EndSelect
WEnd
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

#include <GuiConstants.au3>

GUICreate("", 170, 60,)
$Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21)
GUICtrlSetData($Combo_1, 'Notepad|Calculator')
$Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17)
GUISetState()

While 1
    $MainMsg = GUIGetMsg()
    Select
        Case $MainMsg = $GUI_EVENT_CLOSE
            Exit
        Case $MainMsg = $Button1;Calculator
            If GUICtrlRead($Combo_1) = 'Notepad' Then Run("notepad.exe")
            If GUICtrlRead($Combo_1) = 'Calculator' Then Run("calc.exe")
    EndSelect
WEnd

Edit: Too Slow....

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I am having problems with combo boxes and getting them to execute the write file. In this sample code the combo box will run the notebook but not the calculator. I would like to set it up to just select wich one to go to but then use a button to execute. thanks for the help

comboboxhelp.au3

hey, welcome to the forum.

#include <GuiConstants.au3>
GUICreate("", 170, 60)
GUISetState()
$Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21)
GUICtrlSetData($Combo_1, 'Notepad|Calculator')
$Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17)
While 1
    $MainMsg = GUIGetMsg()
    Select
        Case $MainMsg = $GUI_EVENT_CLOSE
            Exit
        Case $MainMsg = $Button1
             Select
             Case GUICtrlRead($Combo_1) = "Notepad"
                 Run("Notepad.exe")
             Case GUICtrlRead($Combo_1) = "Calculator"
                 Run("Calc.exe")
            EndSelect
    EndSelect
WEnd
            


GUISetState()
While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

***edit*** wow i'm slow today.... hey smoke, you may want to count the commas on your GUICreate()

Edited by cameronsdad
Link to comment
Share on other sites

  • Moderators

No doubt... I fixed the other stuff, and didn't even look there!!

Edit: Super weird it doesn't throw me an error with it like that.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

No doubt... I fixed the other stuff, and didn't even look there!!

Edit: Super weird it doesn't throw me an error with it like that.

what didn't throw an error? it wouldn't execute like that... See, that's why i was 3rd on the responses, i was making sure mine WORKED. :lmao: jdeb's wouldn't run notepad if just pasted in, because of the way the OP had "Notepad |Calculator", and yours wouldn't because of the comma... [/mock criticism in place of a valid excuse for my slow response]
Link to comment
Share on other sites

  • Developers

what didn't throw an error? it wouldn't execute like that... See, that's why i was 3rd on the responses, i was making sure mine WORKED. :lmao: jdeb's wouldn't run notepad if just pasted in, because of the way the OP had "Notepad |Calculator", and yours wouldn't because of the comma... [/mock criticism in place of a valid excuse for my slow response]

whiner ..... ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

No doubt... I fixed the other stuff, and didn't even look there!!

Edit: Super weird it doesn't throw me an error with it like that.

Hi, you can alternate try this script:

#include <GuiConstants.au3>

$NotePad = 0

$Calc = 0

GUICreate("", 170, 60,)

GUISetState()

$Combo_1 = GUICtrlCreateCombo("", 10, 10, 150, 21)

GUICtrlSetData($Combo_1, 'Notepad |Calculator')

$Button1 = GUICtrlCreateButton('GO', 35, 35, 100, 17)

While 1

$MainMsg = GUIGetMsg()

Select

Case $MainMsg = $GUI_EVENT_CLOSE

Exit

Case $MainMsg = $Combo_1 ;NotePad

$NotePad = 1

$Calc = 0

Case $MainMsg = $Combo_1 ;Calculator

$NotePad = 0

$Calc = 1

Case $MainMsg = $Button1

If $NotePad = 1 Then

Run("notepad.exe")

Exit ;????

ElseIf $Calc = 1 Then

Run("calc.exe")

Exit ;????

Else

Exit ;????

EndIf

EndSelect

WEnd

GUISetState()

While GUIGetMsg() <> $GUI_EVENT_CLOSE

WEnd

[font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font]

Link to comment
Share on other sites

  • Moderators

Just put in the fixes that we made. Also, use code tags that are provided in the posting options.

@cameronsdad, since most everything uses beta now a days, I just run the beta version, that's why I didn't get the error I suppose, because I did check it in SciTe before I posted and it ran ;) (your just slow to respond!!) :lmao:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Developers

Is not going to work...... :lmao:

Hi, you can alternate try this script:

Select
        Case $MainMsg = $GUI_EVENT_CLOSE
            Exit
        Case $MainMsg = $Combo_1;NotePad
            $NotePad = 1
            $Calc = 0   
                    
        Case $MainMsg = $Combo_1;Calculator   <== this stament is NEVER reached 
            $NotePad = 0                          <== this stament is NEVER reached 
            $Calc = 1       <== this stament is NEVER reached
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Just put in the fixes that we made. Also, use code tags that are provided in the posting options.

@cameronsdad, since most everything uses beta now a days, I just run the beta version, that's why I didn't get the error I suppose, because I did check it in SciTe before I posted and it ran ;) (your just slow to respond!!) :lmao:

i only use the beta also.... so you tried it and received no error eh?
Link to comment
Share on other sites

  • Moderators

i only use the beta also.... so you tried it and received no error eh?

No, I didn't get an error, but I have everything as beta, no 3.1.1 usage at all, so maybe it didn't do an Au3check, I don't know. But I do know it didn't throw an error :lmao: hmm

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

ok... :lmao: you know half of my job on the forums is to give you a hard time smoke. o:)

And you know I'm only around half the time for your amusement :king:;)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...