MACSCRPT Archives

November 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Emmanuel <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sat, 18 Nov 2006 00:08:12 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (30 lines)
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

Emmanuel

ATOM RSS1 RSS2