Efficiency Chapter--applescript Introduction 2

Source: Internet
Author: User

AppleScript cycle:

(* *  1. Repeat dead Loop *) Set num to 0display dialog num--simplest loop, is dead loop repeatset num to num + 1display dialog numif num≥10 thenexit Repeatend IfEnd Repeat

(*   2. Number of cycles repeat n  times where n can be a variable, can be a constant *)--Create global variable Numset num to 0global numset N to 6--limit loop n repeat n timesrun dial Ogscriptend repeat--Creating custom scripts Script Dialogscriptset num to num + 1display dialog numend script

(*   3. Print 0 ~ 9*) set num to 0--until type loop (*repeat until Num≥10display dialog numset num to num + 1end repeat*)--type loop repeat WHI Le num < 10display dialog numset num to num + 1end Repeat

--Variable loop--advantage: can adjust the span, by Num can be omitted, default is 1repeat with I from 0 to ten by 3display dialog Iend Repeat

--List Loop set students to {"Zhang San", "John Doe", "Harry"}--note here I is the pointer, want to get the content to use contents of I get repeat with I in Studentsdisplay Dialog Contents of Iset (contents of i) to "Xiao Ming" end Repeatdisplay Dialog "" & Students

Efficiency Chapter--applescript Introduction 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.