• 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: Two Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Two Questions


  • Subject: Re: Two Questions
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 14 Feb 2001 18:19:22 +0000

"Serge Belleudy-d'Espinose" wrote on Wed, 14 Feb 2001 15:21:03 +0100:

> on remove_from_list (xItem, xList)
>
> set {oldTID, AppleScript's text item delimiters} to +;
> {AppleScript's text item delimiters, return}
>
> set xList to "" & xList's items
>
> set AppleScript's text item delimiters to xItem
> set xList to xList's text items
>
> set AppleScript's text item delimiters to oldTID
> set xList to "" & xList's items
>
> set AppleScript's text item delimiters to (return & return)
> set xList to (xList's text items)
>
> set AppleScript's text item delimiters to return
> set xList to ("" & xList's items)'s text items
>
> set AppleScript's text item delimiters to oldTID
>
> return xList
>
> end remove_from_list
>
>(watch for +; as continuation char)

Serge,

Try adapting your handler this way:

on remove_from_list(xItem, xList)

set {oldTID, AppleScript's text item delimiters} to +;
{AppleScript's text item delimiters, return}

set xList to return & xList & return

set AppleScript's text item delimiters to return & xItem & return
set xList to xList's text items

set AppleScript's text item delimiters to return
set xList to ("" & xList)'s text items 2 thru -2

set AppleScript's text item delimiters to oldTID

return xList

end remove_from_list

Notice:
1) Both xList and the text item delimiter formed from xItem have a return
at each end (in case you want to remove the first or last items from the
list.)
2) I haven't written "xList's items", which is just a very inefficient
way of saying "xList".
3) The return list is all strings, so the method's only really good if
the original list is all strings too.

NG


  • Prev by Date: RE: Mount volume, slash problem
  • Next by Date: Re: Mount volume, slash problem
  • Previous by thread: Re: Two Questions
  • Next by thread: Re: Two Questions
  • Index(es):
    • Date
    • Thread