• 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: Delete list item?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete list item?


  • Subject: Re: Delete list item?
  • From: JollyRoger <email@hidden>
  • Date: Wed, 24 Oct 2001 06:56:38 -0500

On 10/24/2001 1:20 AM, "Gvran Ehn" <email@hidden> wrote:

> How do I delete a list item?
> Is Akua Sweets the only way to go?

Nope. You can do it with plain AppleScript:

-- begin script
set myList to {"item 1", "item 2", "item3", "item 4"}
return RemoveListItem(1, myList)

on RemoveListItem(x, theList)
-- removes any item from a list
set x to (x as number)
if x < 1 then return theList
set numItems to count of items in theList
if numItems is 1 then return {}
if x > numItems then return theList
if x = 1 then
set newList to (items 2 thru -1 of theList)
else if x = numItems then
set newList to (items 1 thru -2 of theList)
else
set newList to (items 1 thru (x - 1) of theList) & (items (x + 1)
thru -1 of theList)
end if
return newList
end RemoveListItem
-- end script


  • Prev by Date: Re: Recommendations for AppleScript Formatting
  • Next by Date: Re: Adding dialogs to scripts
  • Previous by thread: Re: Delete list item?
  • Next by thread: Re: Delete list item?
  • Index(es):
    • Date
    • Thread