Jump to content

Quick question, Case.. with arrays


Rad
 Share

Recommended Posts

Is there any method to shorten my While loop when I need to check when one of 8x2 buttons have been checked?

Like, i have a form with 8 inputs, followed by 2 buttons each "Change" and "Open"

They are all in arrays: $input[8], $ChangeInput[8], $LaunchInput[8]

Is there anything, like switch or select, to detect when ANY of the buttons have been pressed, but still send the index into the statement? Like this:

Select $msg
    Case $ChangeInput
        Msgbox(0,"",$Input[@index])
    Case $OpenInput
        FileOpen(...)
Endselect

Something like that, they wont actually show a message box and fileopen(), but just an example of what i mean

I looked at helpfile, it doesnt show anything at least where I was looking

Link to comment
Share on other sites

  • Moderators

Although I think I know what you are asking... a working example so I don't waste my time would be nice.

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

Just use a For Loop

$num = 1
For $i to 8 ; Loops 8 times
    If $input[$num] Then
        ;Do whatever here
    EndIf
    
    If $ChangeInput[$num] Then
        ;Do whatever here
    EndIf
    
    If $LaunchInput[$num] Then
        ;Do whatever here
    EndIf
    $num += 1 ;adds 1 to $num
    
    If $num > 8
        $num = 1 ; Resets $num
    EndIf
NextoÝ÷ ØçÜ¢êì{*.Â¥v¯zÚv+mâ²Ö­zg§¶Ëhr'íæî¶Ú'±ªÞmè§Þ²Çl@ÈOöÈbqçmæ«­¬¬j·­Ù^v«¨´éºÚ®¢Ô¨ÁêÞ¶®¶²±ú+¶¢­²ÛºÛhĢǢ~Ø^ɪÞ~í触ëH¬¡j÷¢w¬¢g­)àº'íí7ê)éºÖ«­¬¢²}ý¶wuçméò¢ç;¬¶Ö¤z+hºÖ®¶­sbb33c¶çVÒÒ¤f÷"b33c¶Fò bb33c´6ævTçWE²b33c¶çVÕÒFVâ²VFBFò6V6²bFR'WGFöâ2&W76V@ ´FòvFWfW"W&P VæD`  bb33c´ÆVæ6çWE³ÒFVâ²VFBFò6V6²bFR'WGFöâ2&W76V@ ´FòvFWfW"W&P VæD` b33c¶çVÒ³Ò¶FG2Fòb33c¶çVÐ  bb33c¶çVÒfwC² b33c¶çVÒÒ²&W6WG2b33c¶çVÐ VæD`¤æW@oÝ÷ Ù±!1!?Û8«(騭é¨v'âq«b¢{%¢Qh­Ê'²Ö§¶%)àjëh×6$num = 1
While 1
    If $ChangeInput[$num] Then
        ;Do whatever here
    EndIf
    
    If $LaunchInput[8] Then
        ;Do whatever here
    EndIf
    $num += 1 ;adds 1 to $num
    
    If $num > 8
        $num = 1 ; Resets $num
    EndIf
        sleep(10) ; Lower CPU usage
WEndoÝ÷ ØZ+¢w­g©¢Yb®¶­sbb33c¶çVÒÒ¤f÷"b33c¶Fò bb33c´6ævTçWE²b33c¶çVÕÒFVà ´FòvFWfW"W&P VæD`  bb33c´ÆVæ6çWE³ÒFVà ´FòvFWfW"W&P VæD` b33c¶çVÒ³Ò¶FG2Fòb33c¶çVФæW@
Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
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...