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!
===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)