Re: Question about repeat loop
Re: Question about repeat loop
- Subject: Re: Question about repeat loop
- From: Paul Skinner <email@hidden>
- Date: Sat, 14 Jul 2001 17:27:38 -0400
on 7/14/01 12:47 PM, Phil Calvert wrote:
>
Hi list,
>
>
Can someone tell me why the "if ((TheItem1) is (TheItem2))" is never true in
>
this bit of code but "if ((TheItem1 as text) is (TheItem2 as text))" is
>
true?
Without reading the code I can tell you that no two different items can
be the same item. Two identical toothbrushes are not the same toothbrush.
You have the answer to your script in your comparison as text.
In this case the first list's 'work' is 'item 5 of list1 of +script;'
the second list's 'work' is 'item 2 of list2 of +script;'
>
>
--
>
>
>
set list1 to {"I", "want", "this", "to", "work"}
>
set list2 to {"please", "work"}
>
>
repeat with TheItem1 in list1
>
repeat with TheItem2 in list2
>
if ((TheItem1) is (TheItem2)) then--this is never true
>
display dialog "I'm in the if 1"
>
exit repeat
>
end if
>
end repeat
>
end repeat
>
>
repeat with TheItem1 in list1
>
repeat with TheItem2 in list2
>
if ((TheItem1 as text) is (TheItem2 as text)) then--this works
>
display dialog "I'm in the if 2"
>
exit repeat
>
end if
>
end repeat
>
end repeat
>
>
--
>
>
>
TIA,
>
>
Phil
--
"AppleScript is digital duct tape."
Paul Skinner