Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

AppleScript is a proprietary programming language in macOS to control and exchange data with applications.

AppleScript is a programming language used in macOS to control and exchange data with applications. Its main function is to automate repetitive tasks. AppleScript has some basic functionality of its own, but it mainly relies on other applications to accomplish its tasks. AppleScript has been incorporated into Apple's operating systems since OS 7, in 1993, as an outgrowth of the HyperCard project.

AppleScripts are useful ways to increase efficiency by performing repetitive duties. An example of this can be found in the "Trim File Names" script that is preloaded on macOS systems. Instead of going through file names and deleting chosen phrases by hand, this AppleScript performs a loop and accomplishes the job in several seconds.

The AppleScripting language is based on natural language to decrease the learning curve for AppleScripting. For instance, to display a window with the text "Hello World!" the code goes like this:

display dialog "Hello World!"

AppleScript was created to be easy to use, edit, and write, without learning a whole programming language.

There are several AppleScript editors, both paid and free. Script Editor (AppleScript Editor in macOS versions after Snow Leopard) is included with macOS. It includes syntax highlighting, result windows, and debugging tools. Xcode, which is included in the macOS Developer tools, provides more sophisticated AppleScripting with customizable graphical interfaces, and the ability to turn an AppleScript into a full-fledged application. Smile is a free third-part application that allows for line-by-line testing, and unicode windows. SmileLab is a commercial application developed by the Satimage, the makers of Smile. Script Debugger is another third-part application for AppleScript developing. Script Debugger includes some of the same features as Smile like line-by-line testing. It also includes an advanced application dictionary browser.

For further reading:

history | excerpt history

Code Language (used for syntax highlighting): default