Re: Handlers in list
Re: Handlers in list
- Subject: Re: Handlers in list
- From: Nigel Garvey <email@hidden>
- Date: Sun, 22 Apr 2001 00:16:08 +0100
"Stephen Swift (aka Burnum)" wrote on Sat, 21 Apr 2001 13:14:10 -0400:
>
Code:
>
set DlgResult to {null,null,null,null,null,null,false,true,false,false}
>
set someList to {handler1(), handler2(), handler3(), handler4()}
>
set Num to 1
>
repeat with i from 7 to 10
>
if item i of DlgResult = true then
>
set RunHand to item Num of someList
>
end if
>
set Num to Num + 1
>
end repeat
>
RunHand
global RunHand
set DlgResult to {null,null,null,null,null,null,false,true,false,false}
set someList to {handler1, handler2, handler3, handler4}
repeat with Num from 1 to 4
if item (Num + 6) of DlgResult = true then
set RunHand to item Num of someList
end if
end repeat
RunHand()
The way it's arranged, the script will only run the handler corresponding
to the last 'true' in DlgResult. If you want it to react to more than
one, put the RunHand() line *inside* the loop.
NG