Re: Delete Mail Script
Re: Delete Mail Script
- Subject: Re: Delete Mail Script
- From: 2551 <email@hidden>
- Date: Thu, 08 Aug 2013 08:33:19 +0700
This is the old "Deleting from Array" pothole that every programmer falls into.
If you have messages A,B,C,D,E in the list, then your code will delete message 1(A) - that leaves B,C,D,E
delete message 2(C) - that leaves B,D,E
delete message 3(E) - that leaves B,D
delete message 4 - there is no message 4.
I think Deivy has provided the answer to Robert's problem. But I thought it worth mentioning that the problem Steve's talking about is handled in AppleScript by using the 'rest' property.
set f to {"red", "orange", "yellow"} repeat with i from 1 to number of items in f display dialog (item 1 of f) set f to the rest of f end repeat
Notice the repeat loop only ever asks to display the first item in the list, and yet the script cycles through all items. After each run of 'display dialog', 'rest' deletes the first item of the list and shifts al the remaining items down the list automatically. After the last run, the list is empty and the repeat loop ends (you could also write line 2 as "repeat until f = {}" )
|
_______________________________________________
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