• 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: How to compare contents of a folder against a list?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to compare contents of a folder against a list?


  • Subject: Re: How to compare contents of a folder against a list?
  • From: Axel Luttgens <email@hidden>
  • Date: Sat, 05 May 2007 00:23:38 +0200

On 4/05/07 11:37, KOENIG Yvan wrote:

[...]

I assumes that some small complementary changes may be made because I don't understand the need for a "repeat 1 times" loop.


J.Stewart already replied to this.

AppleScript doesn't provide a "continue" statement, which sometimes proves useful within loops; so, such a code is not conceivable:

   -- Won't work
   repeat with i from 1 to 10
       if i <= 6 or i > 7 then continue
       display dialog i
   end repeat

The "repeat 1 times" trick may be used to simulate, in simple cases, that "continue" statement:

   repeat with i from 1 to 10
       repeat 1 times
          if i <= 6 or i > 7 then exit repeat
          display dialog i
       end repeat
   end repeat

Note how the condition (i <= 6 or i > 7) is preserved.
On the other hand, one may use a "if ... end if" clause; but this means one has to negate the condition:


   repeat with i from 1 to 10
       if i > 6 and i <= 7 then
          display dialog i
       end if
   end repeat

Depending of the case, the "repeat 1 times" may appear more legible or more easily implementable than an "if ... end if".

But sometimes the simplest things are still the easier ones:

   repeat with i from 1 to 10
       if i = 7 then
          display dialog i
       end if
   end repeat

or even:

   display dialog 7

OK, I'm joking here...

Axel
_______________________________________________
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
  • Follow-Ups:
    • How to burn a folder to DVD(s)?
      • From: Rob Stott <email@hidden>
References: 
 >How to compare contents of a folder against a list? (From: "Patrik B." <email@hidden>)
 >Re: How to compare contents of a folder against a list? (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re: Puzzling Error Again
  • Next by Date: Costa Bugg is out of the office.
  • Previous by thread: Re: How to compare contents of a folder against a list?
  • Next by thread: How to burn a folder to DVD(s)?
  • Index(es):
    • Date
    • Thread