• 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
Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?


  • Subject: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
  • From: Jim Witte <email@hidden>
  • Date: Tue, 26 Jul 2005 01:12:13 -0500

Hello,

  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

(Has anyone else noticed there's a (nother) rather horrendous bug in Mail 2.0's editing window regarding text display?  Try creating this message [copy a script in, then type some text after the script on the next line like '[...]' here and watch the the text rendering and left-margin go crazy..  Then save and reopen the draft - text display is fine..  AARRGGGH!!!  And new text that is addeded doesn't seem to render right either..)

ANYWAY..  I can't do this of course because there is no 'next repeat' command is AS (odd omision IMO, as it's in both HC and C as 'continue')  I could do it like this:

repeat with i from 1 to numDocs
    set docName to (name of document i)
    if (docName does contain "blah") then
        set tURL to (URL of document i)        
        [...]
    // else do nothing
    end if
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.  Which is not what I'm coding if here which keeps the "conclusion" [end] of the if block hanging until all the processing is done..  People processing English don't like center-embedded clauses - neither do I when writing code.. [albeit this isn't exactly a center-embedded clause, but it's close IMO])

Jim
 _______________________________________________
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

  • Follow-Ups:
    • Re: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
      • From: Emmanuel <email@hidden>
    • Re: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Passing data to a run handler
  • Next by Date: Re: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
  • Previous by thread: Re: Grabbing info from a webpage
  • Next by thread: Re: Way to get functionality of C's 'continue' or HC 'next repeat' without using if construct?
  • Index(es):
    • Date
    • Thread