• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: lists and items and position of items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lists and items and position of items


  • Subject: Re: lists and items and position of items
  • From: Christian Vinaa <email@hidden>
  • Date: Sat, 12 Mar 2005 14:43:59 +0100

At 07:58 -0500 12/03/2005, Neil Faiman wrote:
On Mar 11, 2005, at 12:48 PM, Michelle Steiner wrote:

On Fri, March 11, 2005 8:50 am, Christian Vinaa said:
...
on list_position(this_item, this_list)
	repeat with i from 1 to the count of this_list
		if item i of this_list is this_item then return i
	end repeat
	return 0
end list_position

because in every instance the handler is returning zero. You need to put "return 0" in an "else" clause of the "if-then" statement

Sorry, but not so. Christian's code is just right. Each time through the loop, it compares an item of the list to the item he is looking for, and returns the value of i, which is the index of that item in the list, if they match -- then the loop doesn't terminate normally and the "return 0" is never reached. If no item matches, then the loop terminates normally, falls out the bottom of the loop, and executes the "return 0".


The problem is as yvan describes -- the fact that Christian is passing a reference rather than a string as the argument to the list_position function.

Regards,

Neil Faiman


just to close this  question;

Yvan  pointed out the correct solution   now it works ok

--
Christian Vinaa

...... Meanwhile, aunt Martha, having taken a tramp in the woods,
is lying in a ditch at the edge of town .........................
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: lists and items and position of items
      • From: Bill Briggs <email@hidden>
References: 
 >lists and items and position of items (From: Christian Vinaa <email@hidden>)
 >Re: lists and items and position of items (From: "Michelle Steiner" <email@hidden>)
 >Re: lists and items and position of items (From: Neil Faiman <email@hidden>)

  • Prev by Date: Re: lists and items and position of items
  • Next by Date: Re: lists and items and position of items
  • Previous by thread: Re: lists and items and position of items
  • Next by thread: Re: lists and items and position of items
  • Index(es):
    • Date
    • Thread