Jump to content

Select...Case...EndSelect question


Recommended Posts

I use a primary Select...Case...EndSelect with 8 choices (which have a secondary Select...Case...EndSelect, this seems to run pretty fast. I added an If...Then before each primary Case which checks to see if it should run or not via 8 radio buttons (user can select what they want to run or not). The speed went straight to pot. Is there a better (faster) way of checking via the radio buttons whether it should run or not?

Example:

Select
    Case
        If GUICtrlRead($Checkbox1) = 1 Then
            Select
                Case
                Case
                Case
            EndSelect
        Case
            If GUICtrlRead($Checkbox2) = 1 Then
                Select
                    Case
                    Case
                    Case
                    Case
                EndSelect
            Case
                If GUICtrlRead($Checkbox3) = 1 Then
                    Select
                        Case
                        Case
                    EndSelect
            EndSelect
Edited by Fossil Rock

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

I use a primary Select...Case...EndSelect with 8 choices (which have a secondary Select...Case...EndSelect, this seems to run pretty fast. I added an If...Then before each primary Case which checks to see if it should run or not via 8 radio buttons (user can select what they want to run or not). The speed went straight to pot. Is there a better (faster) way of checking via the radio buttons whether it should run or not?

Example:

Select
    Case
        If GUICtrlRead($Checkbox1) = 1 Then
            Select
                Case
                Case
                Case
            EndSelect
        Case
            If GUICtrlRead($Checkbox2) = 1 Then
                Select
                    Case
                    Case
                    Case
                    Case
                EndSelect
            Case
                If GUICtrlRead($Checkbox3) = 1 Then
                    Select
                        Case
                        Case
                    EndSelect
            EndSelect
You left off EndIf's and the conditions for the Case lines, but I assume you meant that to be a stripped down example, and they are there in your code. If there is only one 'If' per 'Case' you could use 'And' to put the conditions together and see if that speeds things up:

Select
    Case $a = $b And GUICtrlRead($Checkbox1) = 1
        Select
            Case
            Case
            Case
        EndSelect

    Case $c = $d And GUICtrlRead($Checkbox2) = 1
        Select
            Case
            Case
            Case
            Case
        EndSelect

    Case $e = $f And GUICtrlRead($Checkbox3) = 1
        Select
            Case
            Case
        EndSelect
EndSelect

If the delay comes from the time it takes to do Windows inter-process messaging, this won't buy you anything. Hope it helps. :o

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...