This is actually a bit of a trick question, as there is no AppleScript for loop or while loop syntax. Instead you use the AppleScript repeat command, as shown in the following examples. AppleScript `for` loop examples (“repeat”) Where you might expect an AppleScript for loop to iterate over a list, you use the AppleScript repeat with syntax. Support Communities / Mac OS & System Software / Mac OS X Technologies. Applescript editor 2.6.1, Applescript 2.3.2 on iMac 21,5' running OS X 10.9 Mavericks. I would use AppleScript to run the Curl command and any other command you need to run in order to fetch the file you need to analyze, process it to check for the updated file, and then use the curl command again to download the updated file. If you don't want to use AppleScript. AppleScript Mac OS X Scripting OS X (Moderated by alldritt, Nigel Garvey) 25745. AppleScript was released as part of System 7.1.1 in October 1993 (Contributions by alldritt. Where can I find a Scriptable Text Editor? (Contributions by alldritt, Nigel Garvey) 27: 2005-10-13 03:16:20 pm by julifos.
2 0 likes 11,979 views Last modified Apr 10, 2014 8:53 AM
Getting started
Software
Although there are 3rd party editors available, you don't need any external software to write, compile or run AppleScript scripts. OS X comes bundled with the AppleScript Editor, which you can find on your startup disk at /Applications/Utilities/AppleScript Editor.app.
Applescript Editor On Mac
Learning Guides
![Apple applescript Apple applescript](/uploads/1/1/8/5/118505852/930042567.jpg)
Two widely recommended books for those just starting out with Applescript are
Apple Training Series: AppleScript 1-2-3
Sal Soghoian (Author), Bill Cheeseman (Author)
Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X
Hamish Sanderson (Author), Hanaan Rosenthal (Author)
These are available from large online book retailers and distributors in electronic and print format at quite reasonable prices (at time of writing they're around $20-$25 each). Each is a substantial volume that will serve both as tutorial and reference work.
There are many other books available, but I can personally recommend both the above as highly valuable. 'AppleScript 1-2-3' is probably the better of the two if you are new to AppleScript and to computer programming in general. It is one of the few computer books I've come across that genuinely lives up to the promise of 'no previous experience required'. 'Learn AppleScript' covers some more advanced topics and treats some of the same topics in more depth. The two books are best seen as complementaries rather than alternatives.
Apple provides some free resources, the most useful of which is:
The AppleScript Language Guide
There is an inconspicuous 'PDF' icon at the top right of that page which will allow you to download the entire guide in PDF form, which may be more convenient than reading the online HTML version.
The AppleScript Overview
may also be of interest, though it is largely aimed at developers wishing to make their apps scriptable with AppleScript, rather than for those using AppleScript for scripting. However, if you would like or need a better conceptual understanding of AppleScript and how it fits in with the entire OS X ecology, this will be of interest.
Getting Started with AppleScript
You may often find references in Apple documentation to something called 'Getting Started with AppleScript' but without a link.
This, and pretty much all other public domain documentation for AppleScript, has been collated on an third-party (i.e, not hosted, supported or endorsed by Apple, Inc.) site here:
Getting help
OS X Technologies is the ASC forum for most AppleScript questions,
Applescript Editor Download Mac Installer
but they also do appear on the Developer's forum too.
Perhaps the largest active community of expert and novice AppleScripters alike can be found on the Apple AppleScript mailing list:
A useful external resource both for problem solving and general reference is
http://macscripter.net.
The following site also lists a number of useful links and AppleScript resources:
Using 'do shell script'
One of AS's biggest strengths is its ability to incorporate shell scripts through the 'do shell script' command. However, this is often a source of frequent questions from new scripters. See this article for reference on the ins-and-outs of using shell scripts with AS:
Apple Applescript
Distributing your work
How do I protect my source code?
If you distribute your app without creating a 'run only' version, others will be able to see and modify your source code. To create a 'run only' version use File > Export... and change the File Format: to 'Application'. Check the 'run only' option at the bottom of the dialogue. Note that in earlier versions of the AppleScript Editor and as stated in some of the learning guides above, the 'run only' option was found in File > Save As...' . That is no longer the case.
How do I set the version number for my public releases?
See https://discussions.apple.com/thread/3132455
How do I create an 'Application Support' folder for my app?
See https://discussions.apple.com/thread/4885832?answerId=21505599022#21505599022
Describing AppleScript to a Mac beginner is a bit like three blind men describing an elephant. One man might describe it as the Mac’s built-in automation tool. Another might describe it as an interesting but often-overlooked piece of enabling technology. The third might liken it to a cassette recorder, recording and playing back your actions at the keyboard. A fourth (if there were a fourth in the story) would assure you that it looked like computer code written in a high-level language.
They would all be correct. AppleScript, a built-in Mac automation tool, is a little-known (at least until recently) enabling technology that works like a cassette recorder for programs that support AppleScript recording. And scripts do look like computer programs. (Could that be because they are computer programs? Hmm… .)
If you’re the kind of person who likes to automate as many things as possible, you might just love AppleScript because it’s a simple programming language you can use to create programs that give instructions to your Mac and the applications running on your Mac. For example, you can create an AppleScript that launches Mail, checks for new messages, and then quits Mail. The script could even transfer your mail to a folder of your choice. Then there’s Automator, which includes a whole lot of preprogrammed actions that make a task like the one just described even easier.
AppleScript is a time-and-effort enhancer. If you just spend the time and effort it takes to understand it, using AppleScript can save you oodles of time and effort down the road. Therein lies the rub. This stuff is far from simple; entire books have been written on the subject. Still, it’s worth finding out about if you’d like to script repetitive actions for future use. To get you started, here are a few quick tips:
- Script Editor (in the Utilities folder inside the Applications folder) is the application you use to view and edit AppleScripts. Although more information on Script Editor is beyond the discussion here, it’s a lot of fun. And the cool thing is that you can create many AppleScripts without knowing a thing about programming. Just record a series of actions you want to repeat and use Script Editor to save what you recorded as a script. If you save your script as an application (by choosing Format → Application in the Save sheet), you can run that script by double-clicking its icon.
- You can put frequently used AppleScripts in the Dock or on your Desktop for easy access.
- Many AppleScripts are designed for use in the toolbar of Finder windows, where you can drag and drop items onto them quickly and easily.
- Scripts can enhance your use of many apps including iTunes, iPhoto, and the Finder, to name a few.
- Apple provides a script menu extra that you can install on your menu bar in the Script Editor’s Preferences window, along with a number of free scripts to automate common tasks (in the Scripts folder in the root-level Library, or choose Open Example Scripts Folder from the Script Editor’s Help menu).
- If the concept of scripting intrigues you, explore the examples in the Scripts folder (in the root-level Library or choose Open Example Scripts from the Script Editor’s Help menu). Rummage through this folder and when you find a script that looks interesting, double-click it to launch the Script Editor program, where you can examine it more closely.