I’ve written a fairly simple subroutine to search a list. The subroutine is:
on mySearchList(needle, haystack)
repeat with i from 1 to count of haystack
if needle is equal to item i of haystack then return i
end repeat
return 0
end mySearchList
When I try to call the routine (in a tell application “Address Book,” if that matters):
set indx to mySearchList((first name of staff) as string, person_list)
I get the error: “Address Book got an error: Can’t continue mySearchList.” Can anyone see what I’m doing wrong? TIA.