• 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: Addressing List Items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressing List Items


  • Subject: Re: Addressing List Items
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 04 May 2011 11:36:46 -0400

The  "set item INDEX of LIST" syntax is correct for replacing an existing list item, but it won't add a new item.  Instead, append to the list with "set end of LIST to VALUE".

On Wed, May 4, 2011 at 11:09 AM, Marconi <email@hidden> wrote:
I've never used lists before. I've googled and cannot find an answer to my very basic question.

How does one populate an empty list? What is the proper way to address list items?

set EditArray to {}
set aValue to 0 -- for this example

repeat with LineNumber from 1 to 5
       --here I would calculate the value of EditStart
       set EditStart to aValue

       -- here I would calculate the value of EditEnd
       set EditEnd to aValue
       set item LineNumber of EditArray to {EditStart, EditEnd}

       set LineNumber to LineNumber + 1
end repeat

       Can't set Item 1 of {} to {0, 0}.


Apparently, "Item x of EditArray" is not the proper way to refer to the first record of EditArray. Neither is "record x of EditArray"

What's the proper way to address records of a list?




_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



--
Mark J. Reed <email@hidden>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Addressing List Items
  • Next by Date: Re: Beep no more
  • Previous by thread: Re: Addressing List Items
  • Next by thread: Tabular Data in Dialog
  • Index(es):
    • Date
    • Thread