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
(section)
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!
== 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.
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)