Sender: |
|
Mime-version: |
1.0 |
Date: |
Fri, 17 Nov 2006 15:27:20 -0800 |
Reply-To: |
|
Content-type: |
text/plain; charset="US-ASCII" |
Subject: |
|
From: |
|
In-Reply-To: |
<p06230902c183f100ef50@[10.0.1.7]> |
Content-transfer-encoding: |
7bit |
Parts/Attachments: |
|
|
On 11/17/06 3:08 PM, "Emmanuel" <[log in to unmask]> wrote:
> At 5:55 PM -0500 11/17/06, deivy petrescu wrote:
>> On Nov 17, 2006, at 15:54, Paul Berkowitz wrote:
>>
>>> Perhaps some of you can help out here, or direct me to somewhere I might
>>> find an answer, which will probably be in the shell script area.
>>>
>>
>> Paul;
>> I do not think you need shell.
>> I believe what I propose is a variation of Emmanuel's method, which
>> I could not fully remember.
>
> Here is the official version, where "tid" is a shortcut for "set
> AppleScript's text item delimiters to". That's slightly different
> from Deivy's method, which is excellent also.
>
> on IndexOfItem(theItem, theList)
> set od to tid(return)
> set theList to return & theList & return
> tid(od)
> try
> -1 + (count paragraphs of (text 1 thru (offset of
> (return & theItem & return) in theList) of theList))
> on error
> return 0
> end try
> end IndexOfItem
Ooh, that looks great. (Particularly because, yes, there will be a unique
instance in this list.) And very simple too. Also I'll already have it as
return-delimited text to begin with.
Thanks very much, Emmanuel. Very nice and straightforward.
--
Paul Berkowitz
|
|
|