Sign in to follow this  
Followers 0
radiolover

Combo Box Help

16 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#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

[center]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.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

[center]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.[/center]

Share this post


Link to post
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]

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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]

Share this post


Link to post
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:


[center]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.[/center]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

hey thanks for the help

Share this post


Link to post
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?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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


[center]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.[/center]

Share this post


Link to post
Share on other sites

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 ;) hmm

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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:;)


[center]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.[/center]

Share this post


Link to post
Share on other sites

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

that's why i make up for the other have by getting you twice as much when you are on.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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