Re: Applescript-users Digest, Vol 2, Issue 490
Re: Applescript-users Digest, Vol 2, Issue 490
- Subject: Re: Applescript-users Digest, Vol 2, Issue 490
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 26 Jul 2005 18:35:10 -0700
- Thread-topic: Applescript-users Digest, Vol 2, Issue 490
On 7/26/05 3:04 PM, "Jonathan Levi MD" <email@hidden> wrote:
>> Date: Tue, 26 Jul 2005 01:12:13 -0500
>> From: Jim Witte <email@hidden>
>> Subject: Way to get functionality of C's 'continue' or HC 'next
>> repeat' without using if construct?
>> To: Applescript <email@hidden>
>> Message-ID: <email@hidden>
>
>> I want to write a script that does the following
>>
>> repeat with i from 1 to numDocs
>> set docName to (name of document i)
>> if (docName does not contain "blah") then
>> continue repeat
>> end if
>> set tURL to (URL of document i)
>> [..]
>> end repeat
>>
>> But that looks kind of ugly to me (what I really want to *say* is
>> "if this condition isn't true, skip this data"...
>
> "continue repeat" isn't valid AppleScript, of course. In this case, there
> is a parallel to usual English-composition
> admonition to avoid double-negatives; better to
> say, "If this condition is true, perform the
> procedure using this data":
<snip tedious versions>
> Moral: One can achieve legibility and even
> (sometimes) elegance with AppleScript, by taking
> AppleScript on its own terms. </sermon>
blah, blah
As Yvan already pointed out - using the proper subject line in reply - you
can indeed use AppleScript's own version of 'continue repeat' or 'next', as
first devised by Ray Robertson:
repeat with i from 1 to numDocs
repeat 1 times
set docName to (name of document i)
if (docName does not contain "blah") then
exit repeat -- 1 times
end if
set tURL to (URL of document i)
[..]
end repeat
end repeat
You seem to have missed that (Yvan's reply) the first time around.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden