Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
AppleScript
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{distinguish|Apple (programming language)}} {{Short description|Scripting language for macOS}} {{Use mdy dates|date=March 2020}} {{Infobox programming language | name = AppleScript | developer = [[Apple Inc.]] | year = {{Start date and age|1993}}<ref name="Cook 2006"/> | paradigm =[[Natural language programming]], [[Scripting language|Scripting]] | typing = [[weak typing|Weak]], [[dynamic typing|dynamic]] | latest_release_version = 2.8<ref>[[Apple Inc.]] (2022). [[Script Editor]] (Version 2.11). Retrieved November 11, 2022.</ref> | latest_release_date = {{start date and age|2014|10|16}}<ref>{{cite web|url=https://www.theverge.com/2014/10/16/6978157/mac-os-x-yosemite-release-mac-app-store-october-16th|title=OS X 10.10 Yosemite release date|date=October 16, 2014|access-date=November 16, 2014}}</ref> | operating_system = [[System 7]], [[Mac OS 8]], [[Mac OS 9]], [[macOS]] | license = [[Proprietary software|Proprietary]] (parts available under [[Apple Public Source License|APSL]]) | website = {{URL|https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide}} | influenced_by = [[Natural language programming|Natural language]], [[HyperTalk]] | file_ext = .scpt, .scptd, .applescript }} '''AppleScript''' is a [[scripting language]] created by [[Apple Inc.]] that facilitates [[automation|automated control]] of [[Mac (computer)|Mac]] [[application software|applications]]. First introduced in [[System 7]], it is currently included in [[macOS]] in a package of automation tools. The term ''AppleScript'' may refer to the scripting language, to a script written in the language, or to the macOS [[#Open Scripting Architecture|Open Scripting Architecture]] that underlies the language.<ref name="Goldstein">{{cite book |last=Goldstein |first=Adam |title=AppleScript: the missing manual |location=Sebastopol, CA |publisher=[[O'Reilly Media]] |date=2005 |isbn=0596008503 |oclc=56912218 |url=https://books.google.com/books?id=-ynfWvkwzpwC}}</ref><ref name="Sanderson">{{cite book |last1=Sanderson |first1=Hamish |last2=Rosenthal |first2=Hanaan |title=Learn AppleScript |chapter=Interacting with the Unix Command Line |date=2009 |pages=863–896 |edition=3rd |location=Berkeley |publisher=[[Apress]] |isbn=9781430223610 |oclc=308193726 |doi=10.1007/978-1-4302-2362-7_27 |url=https://books.google.com/books?id=_40AkCe9nOUC}}</ref> AppleScript is primarily a mechanism for driving [[Apple events]] {{endash}} an [[Inter-process communication|inter-application communication]] (IAC) technology that exchanges data between and controls applications.<ref name="Goldstein"/><ref name="Sanderson"/> Additionally, AppleScript supports basic calculations and text processing, and is extensible via [[#Scripting Additions|scripting additions]] that add functions to the language<!--to the language? or to the environment?-->. AppleScript is tightly bound to the Mac environment, similar to how [[Windows Script Host]] is bound to the Windows environment. In other words, AppleScript is not a general purpose scripting language like [[Python (programming language)|Python]]. One way that AppleScript is bound to the unique aspects of its environment is that it relies on applications to publish ''dictionaries'' of addressable objects and operations. As is typical of a command language, AppleScript is not designed to directly perform intensive processing. For example, a script cannot efficiently perform intensive math operations or complicated text processing. However, AppleScript can be used in combination with other tools and technologies which allows it to leverage more efficient programming contexts. The language has aspects of [[Structured programming|structured]], [[procedural programming|procedural]], [[object-oriented programming|object-oriented]] and [[natural language programming|natural language]] programming, but does not strictly conform to any of these [[programming paradigm|paradigms]].<ref name="Sanderson"/>{{rp|xxvi}} == History == In the late 1980s, Apple considered using [[HyperCard]]'s [[HyperTalk]] scripting language as the standard language for [[end-user development]] across the company and within its [[classic Mac OS]] operating system, and for [[interprocess communication]] between Apple and non-Apple products.<ref name="flynn19890227">{{Cite magazine |last=Flynn |first=Laurie |date=February 27, 1989 |title=Apple Ponders Standardizing on HyperTalk |url=https://books.google.com/books?id=IToEAAAAMBAJ&pg=PT30 |magazine=[[InfoWorld]] |page=31 |volume=11 |issue=9}}</ref> HyperTalk could be used by novices to program a HyperCard stack. Apple engineers recognized that a similar, but more object-oriented scripting language could be designed to be used with any [[application software|application]], and the AppleScript project was born as a spin-off of a research effort to modernize the Macintosh as a whole and finally became part of [[System 7 (Macintosh)|System 7]].<ref name="Cook 2006">{{cite conference |author-link1=William Cook (computer scientist) |first=William |last=Cook |book-title=Proceedings of the third ACM SIGPLAN conference on History of programming languages |title=AppleScript |url=http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf |doi=10.1145/1238844.1238845 |isbn= 9781595937667|pages=1–21 |publisher=[[Association for Computing Machinery]] |date=2007|s2cid=220938191 }}</ref> AppleScript was released in October 1993 as part of System 7.1.1 (System 7 Pro, the first major upgrade to System 7).<ref name="Cook 2006"/> [[QuarkXPress]] (ver. 3.2) was one of the first major software applications that supported AppleScript. This, in turn, led to AppleScript being widely adopted within the publishing and prepress world, often tying together complex workflows. This was a key factor in retaining the Macintosh's dominant position in publishing and prepress, even after QuarkXpress and other publishing applications were ported to Microsoft Windows. After some uncertainty about the future of AppleScript on Apple's next generation OS, the move to [[Mac OS X]] (around 2002) and its [[Cocoa (API)|Cocoa]] frameworks greatly increased the usefulness and flexibility of AppleScript. Cocoa applications allow application developers to implement basic scriptability for their apps with minimal effort, broadening the number of applications that are directly scriptable. At the same time, the shift to the Unix underpinnings and AppleScript's ability to run Unix commands directly, with the <code>do shell script</code> command,<ref>{{cite web |url=https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW40 |title=AppleScript Language Guide commands reference: do shell script |website=developer.apple.com |access-date=September 15, 2019}}</ref> allowed AppleScripts much greater control over the operating system itself.<ref name="Sanderson"/>{{rp|863}} [[#AppleScript Studio|AppleScript Studio]], released with [[Mac OS X 10.2]] as part of [[Xcode]], and later [[#AppleScriptObjC|AppleScriptObjC]] framework, released in [[Mac OS X 10.6]], allowed users to build Cocoa applications using AppleScript.<ref name="Sanderson"/>{{rp|969}} In a 2006 article, ''[[Macworld]]'' included AppleScript among its rankings of Apple's 30 most significant products to date, placing it at #17.<ref>{{cite web |title=Apple's greatest hits: 30 significant products |url=https://www.macworld.com/article/1050178/30applelist.html |website=macworld.com |access-date=September 12, 2019}}</ref> In a 2013 article for ''Macworld'', veteran Mac software developer and commentator [[John Gruber]] concluded his reflection on "the unlikely persistence of AppleScript" by noting: "In theory, AppleScript could be much better; in practice, though, it's the best thing we have that works. It exemplifies the Mac's advantages over [[iOS]] for tinkerers and advanced users."<ref>{{cite journal |last=Gruber |first=John |author-link=John Gruber |date=March 2013 |title=The unlikely persistence of AppleScript |journal=[[Macworld]] |volume=30 |issue=3 |pages=100 |url=http://www.macworld.com/article/2018607/the-unlikely-persistence-of-applescript.html}}</ref> In October 2016, longtime AppleScript product manager and automation evangelist [[Sal Soghoian]] left Apple when his position was eliminated "for business reasons".<ref>{{cite web |last=Lovejoy |first=Ben |date=November 17, 2016 |title=Sal Soghoian says 'ask Apple' about future of Mac user automation as company eliminates position |url=https://9to5mac.com/2016/11/17/mac-user-automation-sal-soghoian/ |website=9to5mac.com |access-date=May 8, 2017}}</ref> Veterans in the Mac community such as [[John Gruber]] and [[Andy Ihnatko]] generally responded with concern, questioning Apple's commitment to the developer community and pro users.<ref>{{cite web |last=Evans |first=Jonny |date=November 17, 2016 |title=Does Apple really want to kill Automator, AppleScript? Shock termination of veteran Apple developer guru sends shockwaves across the Mac community |url=http://www.computerworld.com/article/1676596/does-apple-really-want-to-kill-automator-applescript.html |website=[[Computerworld]].com |access-date=May 8, 2017}}</ref> Apple senior vice president of software engineering [[Craig Federighi]] responded in an email saying that "We have every intent to continue our support for the great automation technologies in macOS!", though Jeff Gamet at ''The Mac Observer'' opined that it did little to assuage his doubt about the future of Apple automation in general and AppleScript in particular.<ref>{{cite web |last=Gamet |first=Jeff |date=November 23, 2016 |title=Apple's intent isn't the same as committing to mac automation |url=https://www.macobserver.com/analysis/apple-automation-commitment/ |website=macobserver.com |access-date=May 8, 2017}}</ref> For the time being, AppleScript remains one component of macOS automation technologies, along with [[Automator (software)|Automator]], [[Shortcuts (app)|Shortcuts]], [[Services menu|Services]], and [[shell script]]ing. ==Intent== AppleScript was designed to be used as an accessible end-user scripting language, offering users an intelligent mechanism to control applications, and to access and modify data and documents. AppleScript uses [[Apple events]], a set of standardized data formats that the Macintosh operating system uses to send information to applications, roughly analogous to sending [[XPath]] queries over [[XML-RPC]] in the world of [[web service]]s.<ref name="Sanderson"/>{{rp|xxvi}} Apple events allow a script to work with multiple applications simultaneously, passing data between them so that complex tasks can be accomplished without human interaction.<ref name="Goldstein"/> For example, an AppleScript to create a simple web gallery might do the following: # Open a photo in a photo-editing application (by sending that application an ''Open File'' Apple event). # Tell the photo-editing application to manipulate the image (e.g. reduce its resolution, add a border, add a photo credit) # Tell the photo-editing application to save the changed image in a file in some different folder (by sending that application a ''Save'' and/or ''Close'' Apple event). # Send the new file path (via another Apple event) to a text editor or web editor application. # Tell that editor application to write a link for the photo into an HTML file. # Repeat the above steps for an entire folder of images (hundreds or even thousands of photos). # Upload the HTML file and folder of revised photos to a website, by sending Apple events to a graphical [[FTP]] client, by using built-in AppleScript commands, or by sending Apple events to Unix FTP utilities. For the user, hundreds or thousands of steps in multiple applications have been reduced to the single act of running the script, and the task is accomplished in much less time and with no possibility of random human error. A large complex script could be developed to run only once, while other scripts are used again and again. An application's scriptable elements are visible in the application's Scripting Dictionary (distributed as part of the application), which can be viewed in any [[#Script editors|script editor]]. Elements are generally grouped into ''suites,'' according to loose functional relationships between them. There are two basic kinds of elements present in any suite: classes and commands. * ''Classes'' are scriptable objects—for example, a text editing application will almost certainly have classes for windows, documents, and texts—and these classes will have properties that can be changed (window size, document background color, text font size, etc.), and may contain other classes (a window will contain one or more documents, a document will contain text, a text object will contain paragraphs and words and characters). * ''Commands'', by contrast, are instructions that can be given to scriptable objects. The general format for a block of AppleScript is to ''tell'' a scriptable object to run a command. All scriptable applications share a few basic commands and objects, usually called the Standard Suite—commands to open, close or save a file, to print something, to quit, to set data to variables—as well as a basic ''application'' object that gives the scriptable properties of the application itself. Many applications have numerous suites capable of performing any task the application itself can perform. In exceptional cases, applications may support plugins which include their own scripting dictionaries. AppleScript was designed with the ability to build scripts intuitively by recording user actions. Such AppleScript recordability has to be engineered into the app—the app must support Apple events and AppleScript recording;<ref>{{cite web |title=Scriptable Applications |url=https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptX/Concepts/scriptable_apps.html#//apple_ref/doc/uid/TP40001569-1153888-BAJICJEG |website=developer.apple.com |access-date=July 26, 2018 |language=en}}</ref> as Finder supports AppleScript recording, it can be useful for reference. When [[AppleScript Editor]] (Script Editor) is open and the Record button clicked, user actions for recordable apps are converted to their equivalent AppleScript commands and output to the Script Editor window. The resulting script can be saved and re-run to duplicate the original actions, or modified to be more generally useful. === Natural language metaphor === Whereas Apple events are a way to send messages into applications, AppleScript is a particular language designed to send Apple events. In keeping with the objective of ease-of-use for beginners, the AppleScript language is designed on the [[natural language programming|natural language]] [[metaphor]], just as the [[graphical user interface]] is designed on the [[desktop metaphor]]. A well-written AppleScript should be clear enough to be read and understood by anyone, and easily edited. The language is based largely on HyperCard's HyperTalk language, extended to refer not only to the HyperCard world of cards and stacks, but also theoretically to any document. To this end, the AppleScript team introduced the [[AppleEvent Object Model]] (AEOM), which specifies the objects any particular application "knows". The heart of the AppleScript language is the use of terms that act as nouns and verbs that can be combined. For example, rather than a different verb to print a page, document or range of pages (such as printPage, printDocument, printRange), AppleScript uses a single "print" verb which can be combined with an object, such as a page, a document or a range of pages. <syntaxhighlight lang="AppleScript"> print page 1 print document 2 print pages 1 thru 5 of document 2 </syntaxhighlight> Generally, AEOM defines a number of objects—like "document" or "paragraph"—and corresponding actions—like "cut" and "close". The system also defines ways to refer to properties of objects, so one can refer to the "third paragraph of the document 'Good Day'", or the "color of the last word of the front window". AEOM uses an application ''dictionary'' to associate the Apple events with human-readable terms, allowing the translation back and forth between human-readable AppleScript and [[bytecode]] Apple events. To discover what elements of a program are scriptable, dictionaries for supported applications may be viewed. (In the [[Xcode]] and [[AppleScript Editor|Script Editor]] applications, this is under ''File → Open Dictionary''.) To designate which application is meant to be the target of such a message, AppleScript uses a "tell" construct: <syntaxhighlight lang="AppleScript"> tell application "Microsoft Word" quit end tell </syntaxhighlight> Alternatively, the tell may be expressed in one line by using an [[infinitive]]: <syntaxhighlight lang="AppleScript"> tell application "Microsoft Word" to quit </syntaxhighlight> For events in the "Core Suite" (activate, open, reopen, close, print, and quit), the application may be supplied as the [[Object (computer science)|direct object]] to transitive commands: <syntaxhighlight lang="AppleScript"> quit application "Microsoft Word" </syntaxhighlight> The concept of an object [[hierarchy]] can be expressed using nested blocks: <syntaxhighlight lang="AppleScript"> tell application "QuarkXPress" tell document 1 tell page 2 tell text box 1 set word 5 to "Apple" end tell end tell end tell end tell </syntaxhighlight> The concept of an object [[hierarchy]] can also be expressed using either nested [[prepositional phrase]]s or a series of possessives: <syntaxhighlight lang="AppleScript"> pixel 7 of row 3 of TIFF image "my bitmap" TIFF image "my bitmap"'s 3rd row's 7th pixel </syntaxhighlight> which in another [[programming language]] might be expressed as sequential [[subroutine|method calls]], like in this [[pseudocode]]: <syntaxhighlight lang="JavaScript"> getTIFF("my bitmap").getRow(3).getPixel(7); </syntaxhighlight> AppleScript includes syntax for ordinal counting, "the first paragraph", as well as cardinal, "paragraph one". Likewise, the numbers themselves can be referred to as text or numerically, "five", "fifth" and "5" are all supported; they are synonyms in AppleScript. Also, the word "the" can legally be used anywhere in the script in order to enhance readability: it has no effect on the functionality of the script. ==Examples== ===Hello, world!=== A [["Hello, World!" program]] can be written as a single line. To show a modal window with "OK" and "Cancel" buttons: <syntaxhighlight lang="AppleScript" line> display dialog "Hello, world!" </syntaxhighlight> To show a modal window with an "OK" button and an alert icon: <syntaxhighlight lang="AppleScript" line> display alert "Hello, world!" </syntaxhighlight> To output audio using a synthesized voice: <syntaxhighlight lang="AppleScript" line> say "Hello, world!" </syntaxhighlight> ===Failsafe calculator=== <syntaxhighlight lang="AppleScript" line> tell application "Finder" -- Set variables set the1 to text returned of (display dialog "1st" default answer "Number here" buttons {"Continue"} default button 1) set the2 to text returned of (display dialog "2nd" default answer "Number here" buttons {"Continue"} default button 1) try set the1 to the1 as integer set the2 to the2 as integer on error display dialog "You may only input numbers into a calculator." with title "ERROR" buttons {"OK"} default button 1 return end try -- Add? if the button returned of (display dialog "Add?" buttons {"No", "Yes"} default button 2) is "Yes" then set ans to (the1 + the2) display dialog ans with title "Answer" buttons {"OK"} default button 1 say ans -- Subtract? else if the button returned of (display dialog "Subtract?" buttons {"No", "Yes"} default button 2) is "Yes" then set ans to (the1 - the2) display dialog ans with title "Answer" buttons {"OK"} default button 1 say ans -- Multiply? else if the button returned of (display dialog "Multiply?" buttons {"No", "Yes"} default button 2) is "Yes" then set ans to (the1 * the2) display dialog ans with title "Answer" buttons {"OK"} default button 1 say ans -- Divide? else if the button returned of (display dialog "Divide?" buttons {"No", "Yes"} default button 2) is "Yes" then set ans to (the1 / the2) display dialog ans with title "Answer" buttons {"OK"} default button 1 say ans else delay 1 say "You haven't selected a function. The operation has cancelled." end if end tell </syntaxhighlight> ===Drive login=== This script controls the Finder application to login with [[username]] "John" and [[password]] "app123": <syntaxhighlight lang="AppleScript" line> tell application "Finder" set passAns to "app123" set userAns to "John" if the text returned of (display dialog "Username" default answer "") is userAns then display dialog "Correct" buttons {"Continue"} default button 1 if the text returned of (display dialog "Username : John" & return & "Password" default answer "" buttons {"Continue"} default button 1 with hidden answer) is passAns then display dialog "Access granted" buttons {"OK"} default button 1 else display dialog "Incorrect password" buttons {"OK"} default button 1 end if else display dialog "Incorrect username" buttons {"OK"} default button 1 end if end tell </syntaxhighlight> == Development tools == ===Script editors=== The [[development tools]] below provide a programing environment for scripting with AppleScript {{endash}} supporting composing, validating, compiling, running and debugging scripts. Some also provide for listing AppleScript dictionaries, saving scripts in a number of formats, [[syntax highlighting]] and inserting code snippets. ; [[AppleScript Editor]]: An editor from Apple packaged with macOS, called ''AppleScript Editor'' in [[Mac OS X Snow Leopard]] (10.6) through [[OS X Mavericks]] (10.9) and ''Script Editor'' in all earlier and later versions of macOS. Scripts are written in document editing windows where they can be compiled and run, and these windows contain various panes in which logged information, execution results, and other information is available for debugging purposes. Access to scripting dictionaries and prewritten code snippets is available through the application menus. Since [[OS X Yosemite]] (10.10), Script Editor includes the ability to write in both AppleScript and [[JavaScript]].<ref name="Siracusa JXA"/> ; [[Xcode]]: A suite of tools from Apple for developing applications with features for editing scripts and creating standalone applications written in AppleScript. ;[[Script Debugger]]: An commercial IDE from [[Late Night Software]], Script Debugger is a relatively advanced AppleScript environment that allows the script writer to debug AppleScripts via single [[program animation|stepping]], [[breakpoint]]s, stepping in and out of functions/subroutines, variable tracking, etc. Script Debugger also contains an advanced dictionary browser that allows the user to see the dictionary in action in real world situations. That is, rather than just a listing of what the dictionary covers, one can open a document in [[Pages (iWork)|Pages]], for example, and see how the dictionary's terms apply to that document, making it easier to determine which parts of the dictionary to use. Script Debugger is not designed to create scripts with a GUI, other than basic alerts and dialogs, but is focused more on the coding and debugging of scripts. ;[[Smile (software)|Smile and SmileLab]]: A third-party freeware/commercial IDE for AppleScript, itself written entirely in AppleScript.<ref>{{cite web |url=http://www.satimage.fr/software/en/ |title=Smile and SmileLab Home Page |website=satimage.fr |access-date=May 8, 2017}}</ref> Smile is free, and primarily designed for AppleScript development. SmileLab is commercial software with extensive additions for numerical analysis, graphing, machine automation and web production. Smile and SmileLab use an assortment of different windows—AppleScript windows for running and saving full scripts, AppleScript terminals for testing code line-by-line, unicode windows for working with text and XML. Users can create complex interfaces—called dialogs—for situations where the built-in dialogs in AppleScript are insufficient. ;ASObjC Explorer 4: A discontinued commercial IDE from Shane Stanley for AppleScript, especially for [[#AppleScriptObjC|AppleScriptObjC]].<ref>{{cite web |url=https://www.macosxautomation.com/applescript/apps/explorer.html |title=ASObjC Explorer 4 Discontinued |website=macosxautomation.com |access-date=May 8, 2017 |archive-url=https://web.archive.org/web/20170621152438/http://www.macosxautomation.com/applescript/apps/explorer.html |archive-date=June 21, 2017 |url-status=dead }}</ref> The main feature is [[Cocoa (API)|Cocoa]]-object/event logging, debugging and code-completion. Users can read Cocoa events and objects like other scriptable applications. This tool was originally built for [[#AppleScript Libraries|AppleScript Libraries]] (available in [[OS X Mavericks]]). AppleScript Libraries aims for re-usable AppleScript components and supports built-in AppleScript dictionary (sdef). ASObjC Explorer 4 can be an external Xcode script editor, too. ;FaceSpan: A discontinued commercial IDE from [[Late Night Software]] for creating AppleScript applications with graphic user interfaces.<ref>{{cite web |url=http://blog.latenightsw.com/?cat=10 |title=Mark Alldritt's Journal » FaceSpan |website=blog.latenightsw.com |access-date=May 8, 2017}}</ref> ===Script launchers=== For development and ad hoc scenarios, a script can be run from a script editor, but to support automation a script must run without opening another application. There are a number of options for doing so: ;Applets: AppleScripts can be saved from a script editor as applications (called ''applets'', or ''droplets'' when they accept input via [[drag and drop]]).<ref name="Sanderson"/>{{rp|69}} Applets can be run from the [[Dock (macOS)|Dock]], from the toolbar of [[Finder (software)|Finder]] windows, from [[Spotlight (software)|Spotlight]], from third-party [[application launcher]]s, or from any other place where applications can be run. ;Folder actions: Using AppleScript folder actions, scripts can be launched when specific changes occur in folders (such as adding or removing files).<ref>{{cite web |url=https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_folder_actions.html |title=AppleScript Language Guide: Folder Actions Reference |website=developer.apple.com |access-date=May 8, 2017}}</ref> Folder actions can be assigned by clicking on a folder and choosing ''Folder Actions Setup...'' from the contextual menu; the location of this command differs slightly in Mac OS X 10.6.x from earlier versions. This same action can be achieved with third-party utilities such as Hazel.<ref>{{cite web |last=Miller |first=Dan |date=December 22, 2010 |title=Capsule review: Hazel 2.3 |url=http://www.macworld.com/article/1156565/hazel.html |website=[[Macworld]].com |access-date=May 8, 2017}}</ref> ;Hotkey launchers: [[Keyboard shortcut]]s can be assigned to AppleScripts in the script menu using the ''Keyboard & Mouse Settings'' [[Preference Pane]] in [[System Preferences]]. In addition, various third-party utilities are available—[[Alfred (software)|Alfred]],<ref>{{cite web |last=Beam |first=Brian |date=February 10, 2015 |title=Alfred review: This Mac app launcher continues to shine, but Alfred Remote doesn't stack up |url=http://www.macworld.com/article/2881953/alfred-review-this-mac-app-launcher-continues-to-shine-but-alfred-remote-doesnt-stack-up.html |website=[[Macworld]].com |access-date=May 10, 2017}}</ref> FastScripts,<ref>{{cite web |last=Frakes |first=Dan |date=June 2, 2011 |title=Capsule review: FastScripts 2.5 |url=http://www.macworld.com/article/1160256/fastscripts_25.html |website=[[Macworld]].com |access-date=May 8, 2017}}</ref> [[Keyboard Maestro]],<ref>{{cite web |last=Breen |first=Christopher |date=June 4, 2013 |title=Mac Gems: Keyboard Maestro 6 is a genius at repetitive tasks |url=http://www.macworld.com/article/2040496/mac-gems-keyboard-maestro-6-is-a-genius-at-repetitive-tasks.html |website=[[Macworld]].com |access-date=May 10, 2017}}</ref> QuicKeys,<ref>{{cite web |last=Breen |first=Christopher |date=May 7, 2010 |title=Capsule review: QuicKeys 4 |url=http://www.macworld.com/article/1150918/quickeys4_review.html |website=[[Macworld]].com |access-date=May 8, 2017}}</ref> [[Quicksilver (software)|Quicksilver]],<ref>{{cite web |url=https://docs.qsapp.com/documentation/applescripts |title=AppleScripts – Quicksilver Wiki |website=qsapp.com |access-date=May 10, 2017}}</ref> TextExpander<ref>{{cite web |last=Fleishman |first=Glenn |date=June 12, 2015 |title=TextExpander 5 review |url=http://www.macworld.com/article/2931533/textexpander-5-review-typing-shortcut-utility-makes-you-more-productive-by-learning-your-habits.html |website=[[Macworld]].com |access-date=May 8, 2017}}</ref>—which can run AppleScripts on demand using key combinations. ;Script menu: This system-wide menu provides access to AppleScripts from the macOS menu bar, visible no matter what application is running.<ref>{{cite web |url=https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/UsetheSystem-WideScriptMenu.html |title=Mac Automation Scripting Guide: Using the Systemwide Script Menu |website=developer.apple.com |access-date=May 8, 2017}}</ref> (In addition, many Apple applications, some third-party applications, and some add-ons provide their own script menus. These may be activated in different ways, but all function in essentially the same manner.) Selecting a script in the script menu launches it. Since Mac OS X 10.6.x, the system-wide script menu can be enabled from the preferences of [[AppleScript Editor|Script Editor]]; in prior versions of Mac OS X, it could be enabled from the AppleScript Utility application. When first enabled, the script menu displays a default library of fairly generic, functional AppleScripts, which can also be opened in Script Editor and used as examples for learning AppleScript. Scripts can be organized so that they only appear in the menu when particular applications are in the foreground. ;Unix command line and launchd: AppleScripts can be run from the Unix command line, or from launchd for scheduled tasks,<ref name="Sanderson"/>{{rp|716}} by using the osascript command line tool.<ref>{{cite web |url=https://www.unix.com/man-page/osx/1/osascript/ |title=osascript(1) Mac OS X Manual Page |website=www.unix.com |access-date=July 23, 2024}}</ref> The osascript tool can run compiled scripts (.scpt files) and plain text files (.applescript files—these are compiled by the tool at runtime). Script applications can be run using the Unix open command. ==Resources== ==={{anchor|AppleScript Libraries}}AppleScript Libraries=== Re-usable AppleScript [[Library (software)|module]]s (available since [[OS X Mavericks]]), written in AppleScript or [[#AppleScriptObjC|AppleScriptObjC]] and saved as script files or bundles in certain locations,<ref>{{cite web |url=http://www.macosautomation.com/mavericks/libraries/ |title=AppleScript Libraries |website=macosautomation.com |access-date=May 8, 2017 |url-status=dead |archive-url=https://web.archive.org/web/20200726074006/http://www.macosautomation.com/mavericks/libraries/ |archive-date=2020-07-26}}</ref> that can be called from other scripts. When saved as a bundle, a library can include an AppleScript dictionary (sdef) file,<ref>{{cite web |url=http://asciiwwdc.com/2013/sessions/416 |title=WWDC 2013 Session 416: Introducing AppleScript Libraries |website=asciiwwdc.com |access-date=May 8, 2017}}</ref> thus functioning like a [[#Scripting Additions|scripting addition]] but written in AppleScript or AppleScriptObjC. ==={{anchor|AppleScript Studio}}AppleScript Studio=== A framework for attaching Cocoa interfaces to AppleScript applications, part of the Xcode package in Mac OS X 10.4 and 10.5, now deprecated in favor of AppleScriptObjC.<ref name="Neuburg">{{cite book |last=Neuburg |first=Matt |date=2006 |title=AppleScript: the definitive guide |edition=2nd |location=Beijing |publisher=[[O'Reilly Media]] |isbn=0596102119 |oclc=68694976}}</ref>{{rp|438}} ==={{anchor|AppleScriptObjC}}AppleScriptObjC=== A [[Cocoa (API)|Cocoa]] development [[software framework]], also called AppleScript/Objective-C or ASOC,<ref>{{cite web |last=Tsai |first=Michael |date=September 29, 2014 |title=AppleScript and Yosemite |url=https://mjtsai.com/blog/2014/10/29/applescript-and-yosemite/ |website=mjtsai.com |access-date=May 9, 2017}}</ref> part of the Xcode package since [[Mac OS X Snow Leopard]].<ref>{{cite web |url=https://developer.apple.com/library/content/releasenotes/ScriptingAutomation/RN-AppleScriptObjC/ |title=AppleScriptObjC Release Notes |website=developer.apple.com |access-date=May 8, 2017}}</ref> AppleScriptObjC allows AppleScripts to use Cocoa classes and methods directly.<ref>{{cite web |last=Waldie |first=Ben |date=September 6, 2012 |title=Building a basic AppleScriptObjC (Cocoa-AppleScript) application with Xcode |url=http://www.peachpit.com/articles/article.aspx?p=1942301 |website=peachpit.com |access-date=May 9, 2017}}</ref> The following table shows the availability of AppleScriptObjC in various versions of macOS:<ref>Table adapted from: {{cite web |last=Naganoya |first=Takaaki |title=ASObjCExtras Scripting Guide |url=http://www.piyocast.com/download_file/ASObjCExtras_scripting_guide.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://www.piyocast.com/download_file/ASObjCExtras_scripting_guide.pdf |archive-date=2022-10-09 |url-status=live |website=piyocast.com |access-date=May 9, 2017}}</ref> {| class="wikitable" |+ Where AppleScriptObjC can be used in each macOS version |- ! scope=col | {{Screen reader-only|OS version}} !! scope=col | In [[Xcode]] !! scope=col | In applets !! scope=col | In [[#AppleScript Libraries|AppleScript<br/>Libraries]] !! scope=col | In [[AppleScript Editor|Script Editor]] |- | [[Mac OS X Snow Leopard|10.6]] || {{ya}} || || || |- | [[Mac OS X Lion|10.7]] || {{ya}} || {{ya}} || || |- | [[OS X Mountain Lion|10.8]] || {{ya}} || {{ya}} || || |- | [[OS X Mavericks|10.9]] || {{ya}} || {{ya}} || {{ya}} || |- | [[OS X Yosemite|10.10]] || {{ya}} || {{ya}} || {{ya}} || {{ya}} |- |} AppleScriptObjC can be used in all subsequent Mac OS X versions. ===Automator=== {{Main|Automator (software)}} A graphical, modular editing environment in which ''workflows'' are built up from ''actions''. It is intended to duplicate many of the functions of AppleScript without the necessity for programming knowledge. Automator has an action specifically designed to contain and run AppleScripts, for tasks that are too complex for Automator's simplified framework.<ref>{{cite web |url=https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/AutomatorTutorialAppleScript/Introduction/Introduction.html |title=Introduction to Automator AppleScript Actions Tutorial |website=developer.apple.com |access-date=May 8, 2017}}</ref> ===Scriptable core system applications=== These background-only applications, packaged with macOS, are used to allow AppleScript to access features that would not normally be scriptable. As of Mac OS X 10.6.3 they include the scriptable applications for: :* [[VoiceOver]] (scriptable auditory and braille screen reader package) :* System Events (control of non-scriptable applications and access to certain system functions and basic file operations) :* Printer Setup Utility (scriptable utility for handling print jobs) :* Image Events (core image manipulation) :* HelpViewer (scriptable utility for showing help displays) :* Database Events (minimal SQLite3 database interface) :* AppleScript Utility (for scripting a few AppleScript related preferences) ==={{anchor|Scripting Additions}}Scripting Additions (OSAX)=== Plug-ins for AppleScript developed by Apple or third parties.<ref name="OSAX">{{cite web |url=https://developer.apple.com/library/content/technotes/tn1164/_index.html |title=Technical Note TN1164: Scripting Additions for Mac OS X |website=developer.apple.com |access-date=May 8, 2017}}</ref> They are designed to extend the built-in command set, expanding AppleScript's features and making it somewhat less dependent on functionality provided by applications. macOS includes a collection of scripting additions referred to as Standard Additions (''StandardAdditions.osax'') that adds a set of commands and classes that are not part of AppleScript's core features, including user interaction dialogs, reading and writing files, file system commands, date functions, and text and mathematical operations; without this OSAX, AppleScript would have no capacity to perform many basic actions not directly provided by an application. ==Language== ===Typing=== Variables are not strictly typed, and do not need to be declared. Variables can take any data type (including scripts and functions). For example: <syntaxhighlight lang="AppleScript" line> -- create an integer variable called variable1 set variable1 to 1 -- create a text variable called variable2 set variable2 to "Hello" -- create a list variable called variable3 copy {17, "doubleday"} to variable3 -- copy the list items of variable3 into separate variables variable4 and variable5 set {variable4, variable5} to variable3 -- set a variable to an instance of a script set variable6 to script myScript </syntaxhighlight> ===Scoping=== A subroutines cannot be called directly from an application tell block. Use of <code>my</code> or <code>of me</code> is required. <syntaxhighlight lang="AppleScript"> tell application "Finder" set x to my myHandler() -- or set x to myHandler() of me end tell on myHandler() --commands end myHandler</syntaxhighlight> Using the same technique for scripting addition commands can reduce errors and improve performance. <syntaxhighlight lang="AppleScript"> tell application "Finder" set anyNumber to my (random number from 5 to 50) end tell </syntaxhighlight> ===Types and objects=== A script can define custom data types, or use one of the many built-in classes and objects which are provided by the language and tend to be recognized by scriptable applications. Notable built-in types and objects include: ; Basic objects * '''application''': used mostly as a specifier for tell statements (<code>tell application "Finder" …</code>) * '''script''': script objects are containers for scripts; every AppleScript creates a script object when run, and script objects may be created within AppleScripts * '''class''': meta-object that specifies the type of other objects * '''reference''': object that encapsulates an unevaluated object specifier that may or may not point to a valid object; can be evaluated on-demand by accessing its <code>contents</code> property ; Standard data objects * '''constant''': [[Constant (computer programming)|constant]] value; language-defined constants include <code>pi</code>, <code>tab</code> and <code>linefeed</code> * '''boolean''': [[Boolean data type|Boolean]] (true/false) value; [[Subclass (computer science)|subclass]] of <code>constant</code> * '''number''': [[Abstract type|abstract]] [[Superclass (computer science)|superclass]] of <code>integer</code> and <code>real</code>; rarely used directly * '''integer''': [[Integer (computer science)|integer]]; can be manipulated with built-in mathematical operators * '''real''': [[floating-point]] ([[Real number|real]]) number; can be manipulated with built-in mathematical operators * '''date''': date and time * '''text''': before AppleScript 2.0 (Mac OS X 10.4 and below) the <code>text</code> class was distinct from <code>string</code> and <code>Unicode text</code>, and the three behaved somewhat differently; in 2.0 (10.5) and later, they are all synonyms and all text is handled as [[UTF-16]]<ref name="as-rn-leopard">{{cite web |url=https://developer.apple.com/mac/library/releasenotes/AppleScript/RN-AppleScript/RN-10_5/RN-10_5.html |title=AppleScript Release Notes: 10.5 Changes |website=developer.apple.com |access-date=May 8, 2017}}</ref> ; Containers * '''list''': ordered list of objects; can contain any class, including other lists and classes defined by applications * '''record''': keyed list of objects; like a list, except structured as [[key–value pair]]s; runtime keyed access is unsupported; all keys must be compile-time constant identifiers ; File system * '''alias''': reference to an existing file system object (file or folder); maintains link to file system object if moved or renamed * '''file''': reference to a file system object; can can refer to an object that does not exist * '''POSIX file''': reference to a file system object, in plain text, using Unix ([[POSIX]])-style slash (/) notation; not a true data type, as AppleScript automatically converts a POSIX file to an ordinary file<ref>{{cite web|title=POSIX file — Class Reference — AppleScript Language Guide|url=https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_classes.html#//apple_ref/doc/uid/TP40000983-CH1g-SW15|website=developer.apple.com|access-date=January 8, 2018|language=en}}</ref> ; Miscellaneous * '''RGB color''': specifies an RGB triplet (in [[High color#16-bit high color|16-bit high color]] format), for use in commands and objects that work with colors * '''unit types''': converts between standard units; for instance, a value can be defined as <code>square yards</code>, then converted to <code>square feet</code> by casting between unit types using the <code>as</code> operator ===Block=== AppleScript supports compound statement code structure via either single or multiple line syntax. The multiple line syntax ends a [[code block]] with a phrase that like <code>end ''keyword''</code> where ''keyword'' is the statement keyword at the start of the block. For example: <syntaxhighlight lang="AppleScript"> -- Simple form tell application "Safari" to activate -- Compound tell application "MyApp" -- commands for app end tell </syntaxhighlight> ===Script=== A script object is full object {{endash}} encapsulating methods and data and inheriting data and behavior from a parent script. Script objects can use the same 'tell' constructs that are used for application objects and can be loaded from and saved to files. Runtime performance can be enhanced in some cases by using script objects. A script object is defined as: <syntaxhighlight lang="AppleScript">script scriptName -- commands and handlers specific to the script end script </syntaxhighlight> ===Loop=== The loop construct has multiple variations; all using the keyword '''repeat'''. The loop can be exited via '''exit repeat'''. ; Unconditional <syntaxhighlight lang="AppleScript">repeat -- commands to be repeated end repeat</syntaxhighlight> ; Repeat a number of times <syntaxhighlight lang="AppleScript">repeat 10 times -- commands to be repeated end repeat</syntaxhighlight> ; Conditional For '''repeat while''', the block is executed as long as a condition evaluates to true. The '''repeat until''' loop is the same except that the block is executed as long as the condition evaluates to false. <syntaxhighlight lang="AppleScript">set x to 5 repeat while x > 0 set x to x - 1 end repeat set x to 5 repeat until x ≤ 0 set x to x - 1 end repeat </syntaxhighlight> ; With a variable A variable is initialized to a value and after each execution of the block, the variable is incremented by the step value; 1 if not specified. <syntaxhighlight lang="AppleScript"> -- repeat the block 2000 times, i gets all values from 1 to 2000 repeat with i from 1 to 2000 -- commands to be repeated end repeat -- repeat the block 4 times, i gets values 100, 75, 50 and 25 repeat with i from 100 to 25 by -25 -- commands to be repeated end repeat </syntaxhighlight> ; Enumerate A variable has the value of each list item as the loop progresses. <syntaxhighlight lang="applescript">set total to 0 repeat with loopVariable in {1, 2, 3, 4, 5} set total to total + loopVariable end repeat </syntaxhighlight> ===Handler=== A '''handler''', a variation of the block structure defines a subroutine. ;Function handler <syntaxhighlight lang="AppleScript" line> on myFunction(parameters...) -- subroutine commands end myFunction </syntaxhighlight> ;Folder actions block <syntaxhighlight lang="AppleScript" line> on adding folder items to thisFolder after receiving theseItems -- commands to apply to the folder or items end adding folder items to </syntaxhighlight> ;Run handler <syntaxhighlight lang="AppleScript" line> on run -- commands end run </syntaxhighlight> Handlers can also be defined using "to" in place of "on" and can be written to accept labeled parameters, not enclosed in parens. ;Handler with labeled parameters <syntaxhighlight lang="AppleScript">on rock around the clock display dialog (clock as string) end rock -- called with: rock around the current date </syntaxhighlight> ;Handler using "to" and labeled parameters <syntaxhighlight lang="AppleScript"> to check for yourNumber from bottom thru top if bottom ≤ yourNumber and yourNumber ≤ top then display dialog "Congratulations! You scored." end if end check --called with: check for 8 from 7 thru 10 </syntaxhighlight> There are four types of predefined handlers in AppleScript—run, open, idle, and quit—each of which is created in the same way as the run handler shown above. ;Run handler: Defines the main code of the script, which is called when the script is run. Run handler blocks are optional, unless arguments are being passed to the script. If an explicit run handler block is omitted, then all code that is not contained inside handler blocks is executed as though it were in an implicit run handler. ;Open handler: Defined using "on open theItems". <syntaxhighlight lang="AppleScript">on open theItems repeat with thisItem in theItems tell application "Finder" to update thisItem end repeat end open</syntaxhighlight> When a script containing an "open handler' is saved as an applet, the applet becomes a droplet. A droplet can be identified in the Finder by its icon, which includes an arrow, indicating items can be dropped onto the icon. The droplet's open handler is executed when files or folders are dropped onto droplet's icon. References to the items dropped on the droplet's icon are passed to the droplet's script as the parameter of the open handler. A droplet can also be launched the same way as an ordinary applet, executing its run handler. ;Idle handler: A subroutine that is run periodically by the system when the application is idle. <syntaxhighlight lang="AppleScript">on idle --code to execute when the script's execution has completed return 60 -- number of seconds to pause before executing idle handler again end idle</syntaxhighlight> An idle handler can be used in applets or droplets saved as stay-open applets, and is useful for scripts that watch for particular data or events. The length of the idle time is 30 seconds by default,<ref>{{cite web |url=https://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html#//apple_ref/doc/uid/TP40000983-CH206-SW14 |title=AppleScript Language Guide: Handlers in Script Applications |website=developer.apple.com |access-date=July 21, 2013}}</ref> but can be changed by including a 'return x' statement at the end of the subroutine, where x is the number of seconds the system should wait before running the handler again. ;Quit handler: A handler that is run when the applet receives a Quit request. This can be used to save data or do other ending tasks before quitting. <syntaxhighlight lang="AppleScript">on quit --commands to execute before the script quits continue quit -- required for the script to actually quit end quit</syntaxhighlight> ===Comment=== A [[Comment (computer programming)|comment]] can be formatted various ways. A line comment begins with <code>--</code> or alternatively in later versions (AppleScript 2.0, first released in [[Mac OS X Leopard]]) with {{code|#}}. The latter permits an AppleScript script to run as an executable if it begins with a [[shebang line]] <code>#!/usr/bin/osascript</code>. For example: <syntaxhighlight lang="AppleScript"> --This is a line comment # So is this! (in later versions) </syntaxhighlight> A block comment (can be multiple lines) is delimited by <code>(*</code> and <code>*)</code>. For example: <syntaxhighlight lang="AppleScript"> (* This is a multiple line comment *) </syntaxhighlight> ===User interaction=== AppleScript has several user interface options, including dialogs, alerts, and list of choices. (The character, produced by typing {{keypress|option|return}} in the Script Editor, denotes continuation of a single statement across multiple lines.) <syntaxhighlight lang="AppleScript"> -- Dialog set dialogReply to display dialog "Dialog Text" default answer "Text Answer" hidden answer false buttons {"Skip", "Okay", "Cancel"} default button "Okay" cancel button "Skip" with title "Dialog Window Title" with icon note giving up after 15 </syntaxhighlight> <syntaxhighlight lang="AppleScript"> -- Choose from list set chosenListItem to choose from list {"A", "B", "3"} with title "List Title" with prompt "Prompt Text" default items "B" OK button name "Looks Good!" cancel button name "Nope, try again" multiple selections allowed false with empty selection allowed </syntaxhighlight> <syntaxhighlight lang="AppleScript"> -- Alert set resultAlertReply to display alert "Alert Text" as warning buttons {"Skip", "Okay", "Cancel"} default button 2 cancel button 1 giving up after 2 </syntaxhighlight> Each user interaction method can return the values of buttons clicked, items chosen or text entered for further processing. For example: <syntaxhighlight lang="AppleScript"> display alert "Hello, world!" buttons {"Rudely decline", "Happily accept"} set theAnswer to button returned of the result if theAnswer is "Happily accept" then beep 5 else say "Piffle!" end if </syntaxhighlight> == Open Scripting Architecture == Apple provides the '''Open Scripting Architecture''' (OSA) for other scripting languages and third-party scripting/automation products (such as QuicKeys and [[UserLand Software|UserLand]] Frontier) to function on an equal status with AppleScript. AppleScript is implemented as a component of [[Component Manager]], and the basic specs for interfacing such components to the OSA are public, allowing other developers to add their own scripting components to the system. Public client [[Application programming interface|API]]s for loading, saving and compiling scripts work the same for all such components, which means that applets and droplets can hold scripts in any of those scripting languages.<ref>{{cite web |url=https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptX/Concepts/osa.html |title=AppleScript Overview: Open Scripting Architecture |website=developer.apple.com |access-date=May 8, 2017}}</ref> One feature of the OSA is [[#Scripting Additions|scripting additions]], or OSAX for ''Open Scripting Architecture eXtension'',<ref name="OSAX"/> which were inspired by [[HyperCard]]'s External Commands. Scripting additions are [[Library (software)|libraries]] that allow programmers to extend the function of AppleScript. Commands included as scripting additions are available system-wide, and are not dependent on an application (see also {{section link||AppleScript Libraries}}). The AppleScript Editor is also able to directly edit and run some of the OSA languages. ===JavaScript for Automation=== <!--[[JavaScript for Automation]] redirects here ([[MOS:HEAD]])--> {{Expand section|with=comparison of JXA and AppleScript scripting|date=May 2017}} Under [[OS X Yosemite]] and later versions of macOS, the '''JavaScript for Automation''' ('''JXA''') component remains the only serious OSA language alternative to AppleScript,<ref name="Siracusa JXA">{{cite web |last=Siracusa |first=John |date=October 16, 2014 |title=OS X 10.10 Yosemite: The Ars Technica Review: JavaScript automation |url=https://arstechnica.com/apple/2014/10/os-x-10-10/24/#javascript-automation |website=[[Ars Technica]] |access-date=May 8, 2017}}</ref> though the Macintosh versions of [[Perl]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], and [[Tcl]] all support native means of working with Apple events without being OSA components.<ref name="Neuburg"/>{{rp|516}} JXA also provides an [[Objective-C]] (and C language) foreign language interface.<ref name="Siracusa JXA"/> Being an environment based on WebKit's JavaScriptCore engine, the JavaScript feature set is in sync with the system Safari browser engine. JXA provides a JavaScript module system and it is also possible to use [[CommonJS]] modules via browserify.<ref>{{cite web |title=Importing Scripts |url=https://github.com/JXA-Cookbook/JXA-Cookbook/wiki/Importing-Scripts |website=GitHub |publisher=JXA-Cookbook |access-date=December 9, 2019 |date=December 6, 2019}}</ref> ==See also== * {{Annotated link|ARexx}} == References == {{Reflist|colwidth=30em}} ==Further reading== <!-- Reverse chronological order: more recent sources are more up-to-date --> * {{cite web |title=AppleScript Language Guide |website=developer.apple.com |url=https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html |date=2016 |access-date=May 9, 2017}} * {{cite book |first=Mark Conway |last=Munro |title=AppleScript |series=Developer Reference |location=Indianapolis |publisher=Wiley |date=2010 |isbn=978-0-470-56229-1 |oclc=468969567 }} * {{cite book |first1=Hanaan |last1=Rosenthal |first2=Hamish |last2=Sanderson |title=Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X |edition=3rd |location=Berkeley |publisher=[[Apress]] |date=2010 |isbn=978-1-4302-2361-0 |oclc=308193726 |doi=10.1007/978-1-4302-2362-7 }} * {{cite book |first1=Sal |last1=Soghoian |author-link1=Sal Soghoian |first2=Bill |last2=Cheeseman |title=Apple Training Series: AppleScript 1-2-3 |series=Apple Pro training series |location=Berkeley |publisher=[[Peachpit Press]] |date=2009 |isbn=978-0-321-14931-2 |oclc=298560807 |url=https://archive.org/details/applescript1230000sogh |url-access=registration }} * {{cite conference |author-link1=William Cook (computer scientist) |first=William |last=Cook |book-title=Proceedings of the third ACM SIGPLAN conference on History of programming languages |title=AppleScript |url=http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf |doi=10.1145/1238844.1238845 |isbn= 9781595937667|pages=1–21 |publisher=ACM |date=2007 |s2cid=220938191 |citeseerx=10.1.1.86.2218}} * {{cite book |first=Jerry Lee |last=Ford Jr. |title=AppleScript Programming for the Absolute Beginner |location=Boston |publisher=Thomson [[Course Technology]] |date=2007 |isbn=978-1-59863-384-9 |oclc=76910522 |url=https://archive.org/details/applescriptstudi0000ford |url-access=registration }} * {{cite book |first=Matt |last=Neuburg |title=AppleScript: The Definitive Guide |edition=2nd |location=Beijing; Farnham |publisher=[[O'Reilly Media]] |date=2006 |isbn=0-596-10211-9 |oclc=68694976 |url=https://archive.org/details/applescriptdefin00neub |url-access=registration }} * {{cite book |first=Adam |last=Goldstein |title=AppleScript: The Missing Manual |series=Missing Manual series |location=Sebastopol, CA; Farnham |publisher=O'Reilly Media |date=2005 |isbn=0-596-00850-3 |oclc=56912218 |url=https://archive.org/details/applescriptmissi0000gold/ |url-access=registration }} * {{cite book |first=Tom |last=Trinko |title=AppleScript for Dummies |edition=2nd |series=[[For Dummies]] series |location=Hoboken, NJ |publisher=Wiley |date=2004 |isbn=978-0-7645-7494-8 |oclc=56500506 |url=https://archive.org/details/applescriptfordu0000trin |url-access=registration }} == External links == {{Wikibooks|AppleScript}} * {{cite web |title=AppleScript Overview |website=developer.apple.com |url=https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html |date=2007 |access-date=November 7, 2020}} * {{cite web |title=AppleScript for Python Programmers (Comparison Chart) |url=http://aurelio.net/articles/applescript-vs-python.html |website=aurelio.net |date=2005 |access-date=May 9, 2017}} * {{cite web |url=http://dougscripts.com/itunes/ |title=Doug's AppleScripts for iTunes |website=dougscripts.com |access-date=May 9, 2017}} * {{cite web |url=http://macscripter.net/ |title=MacScripter AppleScript community |website=macscripter.net |access-date=May 9, 2017}} {{macOS}} {{Authority control}} {{DEFAULTSORT:Applescript}} [[Category:Macintosh operating systems development]] [[Category:MacOS development]] [[Category:Proprietary software]] [[Category:Scripting languages]] [[Category:Programming languages]] [[Category:High-level programming languages]] [[Category:Programming languages created in 1993]] [[Category:1993 software]] [[Category:Dynamic programming languages]] [[Category:Dynamically typed programming languages]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Annotated link
(
edit
)
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite conference
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite magazine
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Distinguish
(
edit
)
Template:Endash
(
edit
)
Template:Expand section
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Keypress
(
edit
)
Template:MacOS
(
edit
)
Template:Main
(
edit
)
Template:Reflist
(
edit
)
Template:Rp
(
edit
)
Template:Screen reader-only
(
edit
)
Template:Section link
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Use mdy dates
(
edit
)
Template:Wikibooks
(
edit
)
Template:Ya
(
edit
)