• 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: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


  • Subject: Re: (no subject)
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 20 Nov 2003 11:06:34 -0800

On Nov 20, 2003, at 9:44 AM, Wallace, William wrote:

Okay, is there any way to make a repeat loop count backwards like the following snippet does not:

set loop_list to {"a", "b", "c", "d"}

repeat with i from (count of loop_list) to 1
display dialog item i
end repeat

-->does nothing. presumably because the repeat loop ends before it starts because the start value is greater than the stop value and "repeat with i from..." wants to increment.

Yes, but you're very close. Just add "by -1" to the end of the "repeat" line. (And add "of loop_list" after "item i", or it's not going to know what you're asking for an item of.) This is documented in the AppleScript Language Guide.


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >(no subject) (From: "Wallace, William" <email@hidden>)

  • Prev by Date: Re: Read text error
  • Next by Date: Re: (no subject)
  • Previous by thread: Re: (no subject)
  • Next by thread: Re: (no subject)
  • Index(es):
    • Date
    • Thread