seems to meny If

Rob Cozens rcozens at pon.net
Fri Nov 25 10:40:39 EST 2005


Hi Liam,

>how do I write this in a switch statement or is there a better way
>to write it
>
>if it contains JK then send mouseUp to button "NextTrack"
>     if it contains AB then send mouseUp to button "NextTrack"
>     if it contains JL then send mouseUp to button "playpause"
>     if it contains JM then send mouseUp to button "back"
>     if it contains GK then send mouseUp to button "1"
>     if it contains HK then send mouseUp to button "2"
>     if it contains IK then send mouseUp to button "3"
>     if it contains GL then send mouseUp to button "4"
>     if it contains HL then send mouseUp to button "5"
>     if it contains IL then send mouseUp to button "6"
>     if it contains GM then send mouseUp to button "7"
>     if it contains HM then send mouseUp to button "8"
>     if it contains IM then send mouseUp to button "9"
>     if it contains HN then send mouseUp to button "10"
>     if it contains "IN" then send mouseUp to button "11"
>     if it contains GN then send mouseUp to button "12"

Note that the following switch logic only works if the 16 if 
statements are mutually exclusive (ie: it cannot contain both AB and 
JL, for example)

switch
         case (it contains JK) -- your handler responds identically to JK & AB
         case (it contains AB)
                 send mouseUp to button "NextTrack"
                 break
         case (it contains JL)
                 send mouseUp to button "playpause"
                 break
         case (it contains JM)
                 send mouseUp to button "back"
                 break
         case (it contains GK)
                 send mouseUp to button "1"
                 break
         case (it contains HK)
                 send mouseUp to button "2"
                 break
         case (it contains IK)
                 send mouseUp to button "3"
                 break
         case (it contains GL)
                 send mouseUp to button "4"
                 break
         case (it contains HL)
                 send mouseUp to button "5"
                 break
         case (it contains IL)
                 send mouseUp to button "6"
                 break
         case (it contains GM)
                 send mouseUp to button "7"
                 break
         case (it contains HM)
                 send mouseUp to button "8"
                 break
         case (it contains IM)
                 send mouseUp to button "9"
                 break
         case (it contains HN)
                 send mouseUp to button "10"
                 break
         case (it contains "IN")
                 send mouseUp to button "11"
                 break
         case (it contains GN)
                 send mouseUp to button "12"
                 break
end switch

Rob Cozens CCW
Serendipity Software Company

"And I, which was two fooles, do so grow three;
  Who are a little wise, the best fooles bee."

  from "The Triple Foole" by John Donne (1572-1631) 




More information about the use-livecode mailing list