Everything You Should Know About AppleScript

Before we begin with AppleScript , we do realise that in this rapidly growing world of technology, our daily tasks and complex operations are becoming easier. Everything is happening at such fast speeds that we cannot afford to be slow at any time. Being slow once impacts our personal growth and our being left behind in the world. Now we have bullet trains running at super-fast speeds and supercomputers to handle complex calculations and other technical operations at super speeds. This leaves us standing at a place where we have to choose between growth and our traditional approaches. Do we want to stick to old and traditional approaches and be left behind, or do we want to grow with growth in technology? The majority of the people will answer grow with growth in technology which has to be chosen now or sometime later. The sooner you choose, the better it is for you.

One such advancement came with the introduction of Apple into the market by Apple Inc. Apple Inc. was founded by Steve Jobs, Steve Wozniak, and Ronald Wayne on 1st April 1976, with its headquarters in California, US. To date, it continues to amaze us with its different powerful and ahead of time products. Now, we have Macintosh from Apple and Apple mobile phones and smartwatches.

Suppose you have been a personal computer user and now using Macintosh. In that case, you must have experienced the difference between a Mac and any other PC. Mac has a lot of advantages over PCs and laptops. Some are better-operating systems, no need for any drivers, and are highly portable with their sleek designs and lightweight features. But then there comes a question, is it affordable? To some people, it may be not today, but since it\’s a one-time investment, we have to think before a purchase like this. Again if we have to grow, then we have to use the latest and the best in the market.
Also, once an Apple user kind of becomes like always an Apple user.

Haven\’t this question crossed your mind, what is it that makes Apple products better than others? First, of course, the operating system begins the operations and the script running in the background and helping the operating system.

One such script that is involved and majorly used in Macintosh by Apple Inc. is Applescript. Ever come across this term but still are not clear what it is, how, and where it is used? Then, you are just on the right article, on \’Everything you need to know about Applescript\’.


In common terms, it is the language used in programming and controlling applications of Macintosh. However, in technical terms, we can state that Applescript is a scripting language, more like an automating solution for Macintosh Operating System, created by Apple Inc. It automates the tasks by interacting with different apps and Finder on the Mac.
Applescript performs actions required by the user or the operating system with the use of \”intelligence\”. It can control the applications and make decisions based on the information from its interactions with that application manually or automatically and its observations. It can handle all easy and complex operations, from file copying to building catalogues for real estate.


It was released in October 1993 as part of Mac OS System 7. With Mac OS X, its power increased. Its stable release was in October 2014. It is now present in all versions of Mac OS and is a part of a package of system automation tools.

It was developed for Inter-Application Communication through Apple Events which is, in turn, are responsible for the exchange of data and information. To automate repetitive tasks on Mac OS, Apple events are used to control different applications.


Apart from sending Apple events, Applescript has the ability to process the data. It can perform simple calculations and also process texts. Also, it is an extensible language that allows the usage of scripting extensions to add new capabilities to the language. However, to accomplish complex operations, Applescript mostly relies on the functionalities of the processes and the applications.

Applescript has elements from different programming paradigms, such as natural language programming in syntax, object-oriented programming for objects in the script, and procedural programming.

How does it work?

Any computer completes a task by performing a series of operations fed to it via the programming/ scripting language behind the development. Similarly, Mac reads the sequential instructions given by the scripts, written in Applescript, to automate any actions performed by the application. These instructions read are then communicated to the target applications. The applications then read and interpret these instructions and then perform the actions received step by step.
The scripts in Applescript are composed of words from English-like language. It contains many nouns, verbs, articles, adjectives, and many other elements from the language we use in our day-to-day life. Applescript is specially designed in a way that it is easy for any human and Mac to understand. The grammatical structure and syntax are quite similar to our normal sentences.


Mac OS provides a free application/ editor for Applescript with all the utility built-in. All the scripts are written in this Script Editor, which can also run these scripts. The save format can be a script application or script file, which can be used from any application at any time.

You can use the Mac OS Script menu or an application\’s script menu to launch the script. You can run the preinstalled scripts from Mac HD > Library > Script or run the Editor scripts. The Script Editor can be searched in the Mac or by Preferences > General > Show Script Menu > Click on the script icon in the menu.

On the Mac, everything is an object, and this is the basic concept of Applescript. Everything in the system is somehow related to or belongs to something else. Applescript uses a hierarchical containment structure; it identifies the specific object and its hierarchical reference, the \’Chain of Command\’.

You might have understood what an Applescript is and how it works in Mac OS by this time. But don\’t you feel like trying your hands on it?
Let\’s begin with writing a basic Applescript program. But first, we need to understand the Editor. It consists of two sections, the first section on the top is to write the script and the lower section is to display the output on running the above-written script.
Step 1 is to create the script file, which will contain your program. First, open the Script Editor on your Mac, go to File in the menu on the top, and click on New.

As in the below-given image:


Now we will write our first script, say \’Hello, my name is Apple\’.
tell application \”System Events\” to display dialog \”Hello, my name is Apple!!\”

This is simple as commanding someone in English.
To run a script, we just have to compile it that is compiler checks for syntax errors. Errors will be displayed via a dialog. If there is no error, then your script\’s formatting and font are changed. Finally, click the \”hammer button\” right above the script\’s menu bar to compile.

There you go!! You have your first script. Now let\’s see the output. Click on the play button next to the hammer button in the same menu and see how your script is saying, \”Hello, my name is Apple!!\”

This script can be saved as an application, too, then just clicking on that application will run the script without the help of Script Editor. Click on File> Save. Give a name to your File and the format as \’application\’.
Tadaa!! There you have your very first Applescript

Let us explore some other variations in this basic script we have written above.
Applescript provides us with many interfaces to work with. Some of them are alerts, dialogs, and a list of choices. We have seen an interface \’dialog\’ from the above script. Now, it\’s time for some other.

display alert \”Hello, my name is Apple!!\” . This script will open a small window on your Mac with an alert icon and the phrase \’Hello, my name is Apple!!\’ along with an OK button.
Say \”Hello, my name is Apple!!\” this will be an audio message. A computerized voice will say the text provided by you in the script that is \”Hello, my name is Apple\”.


The tell statement
Since the syntax of Applescript is human-readable, the commands the statements all are general English elements. Let\’s take a look at the most common and important statement; the tell statement.

It comprises of :
The command \’tell.\’
The reference object
The action that has to be performed


With the help of our first script that we have written above, we will now dive deep into what and how our script is working and commanding.
In common terms, this statement is telling System Events to display a dialog stating, \”Hello, my name is Apple!!\”. System Events on your Mac will read and execute the instruction by displaying a dialog window with the words \”Hello, my name is Apple!!\” from your script. The window also has an OK and a Cancel button to close it.

Loops and conditions are also available with Applescript. We can do a lot using loops when we have to repeat certain tasks or lines of code; loops come in handy. In case we have conditional execution of code, we can use the conditional commands provided by Applescript.

Seems interesting, right? To learn more about the syntax of Applescript, you can visit Apple\’s website for it. It is a guide to learning the Applescript language for a beginner.


This scripting language was designed for easy accessibility for end-users and to provide an intelligent mechanism for automated application controls and data access and modification. Now it, in a way, controls nearly all the applications in Mac. Some of the common usages are:

  • For self-contained as well as simple solutions.
  • For everyday utilities, like managing network activities, files and, folders, and monitoring disk usages.
  • For backing up files.
  • For accessing web pages or driving a website
  • Co-ordinate calendars among different sites
  • Find similar photos
  • Diagnose errors in a file, folder, or the system
  • Finding jobs
  • Textual data parsing, invoking functionality and, running programs
  • Run sophisticated or long series of shell commands
  • Updating meeting status, controlling VPN, dismissing old notifications
  • Remove duplicates created in folders or your calendars
  • To rename or compress files

Applescript can be many more uses, depending on how you want to play around with it and make the most of it.
It can automate your tasks and workflows; you can use it to parse files, convert sheets, disk cleanup, image conversions, and many other day-to-day, and repetitive tasks on your system. It may not be a very powerful language, but it comes in handy because of its English-like syntax. You can use your scripts on your application to get them to perform a specific operation related to their core functionality. You can explore more about how you can efficiently make use of this language, as per your use-cases.

Any language with its power can do anything. It depends on us humans how we use it for our benefit. If a line of code can help us, that line of code can also destroy certain things. It\’s on us how we utilize it to the fullest and the best of interest of humankind.

Now, you know everything about Applescript, and you know how and where to use it. This article has given you all the knowledge about the language, how it has originated, what its powers are, and how it has made our day-to-day tasks easier just by a simple automation script. Knowing all this, do you feel like creating more and more scripts on your Mac and automating your tasks? This has become quite easier now with the knowledge attained. You now know where to create a script, what do you want your script to do, how to run your script and how to make it useful for you in all possible ways.

This is a helpful language to anyone who wants to experiment and utilise all its functionalities.
You have your Mac, knowledge of Applescript, and that\’s it. You don\’t need anything else, not a notepad, not a To-do list, just type a script, attach it to your application, and you are done. Happy exploring!!

Also Read : Cloud Computing 101? Future Of Cloud Computing in India?

For more such content , follow us on:


Leave a Comment

Your email address will not be published. Required fields are marked *