Home > Wiki Tips

[Explained]How to Use Script Editor on Mac

Updated on Tuesday, May 7, 2024

iBoysoft author Amanda Wong

Written by

Amanda Wong
Professional tech editor

Approved by

Jessica Shee

English

Get to Know the macOS Utility - Script Editor

Summary: This is an explanation of Script Editor, a macOS built-in utility. After reading, you will know what the Script Editor is on Mac and how to create a script on Mac.

script editor Mac

Mac computers are suitable for software partitioners given that based on Unix, macOS is friendly to the software developer, the system is stable and secure, and there is various professional software for you to boost productivity. Here, we are going to talk about the Script Editor, a utility included in Mac OS X and macOS.

What is Script Editor on Mac

The script is a kind of programming language, a sequence of computer commands for a program to interpret. The utility to handle script-related work is called Script Editor(called AppleScript Editor from 2009 to 2014) on your Mac. It is used to view an app's scripting dictionary, edit saved scripts, and create powerful scripts, tools, and even apps. 

You can use Script Editor to create scripts to perform repetitive tasks and automate complete workflows( these can also be realized with other two macOS features, the Monterey Shortcuts app, and Automator). Besides, you can create scripts to control the app and even the system.

How to use Script Editor on Mac

Navigate to Finder > Applications > Utilities, you can find Script Editor here, double-click it to run the program on your Mac. Then it presents you with a window to create a new script. 

script editor main interface

The Script Editor supports two scripting languages, including Applescript and Javascript, tap the language button to expand the drop-down menu and choose a language to view, edit, and create scripts. 

With the toolbar located in the upper right corner, you get the buttons to Record, Stop, Run, and Compile. And the other two buttons are used to hide and show Accessory View and Bundle Contents.

At the bottom of the Script Editor's window, there are buttons for Description, Result, Log, Clear the Log, and Log History.

Set up Mac Script Editor

You can change some settings of the Script Editor as you prefer from Script Editor's Preferences: On the top menu bar, tap Script Editor and choose Preferences. There are four tabs, including General, Editing, Formatting, and History.

  • General: Choose the default script editor on your Mac, and the default script language, default target, whether to show the inherited items, and whether and where to show the script menu.
  • Editing: Enable the code completion here, set the tab width by space, and turn on the line rapping and formatting.
  • Formatting: Choose the font, color, and size for the category, and double-click the category to change the formatting.
  • History: Enable the log history with unlimited or maximum entries and choose logging only when visible.

script editor preferences

View scripts in Script Editor

You can view an app's scripting dictionary with Script Editor on Mac:

  1. On Script Editor's main interface, choose Window > Library from the top menu bar.
  2. Double-click the name of the aim app in the Library window. 
  3. Click the Language pop-up menu, then choose a scripting language.
  4. Select a suite.

Edit scripts in Script Editor

  1. Open the script on Mac. You can open the script by going ahead to Finder on your Mac, and dragging the script's icon onto the Script Editor icon or window. Or, in Script Editor, choose File > Open, then select your script.
  2. Edit the script. It allows you to copy text from another document or webpage and paste it into Script Editor, or you can directly drag selected text from other apps or text clippings from the Finder into an open window in Script Editor.
  3. Click the Compile button to compile the script. It adds indents to help you see the organized structure and applies different styles to different elements in your script.
  4. Choose File > Save to save the script and choose a format:
  • Script: An editable Script Editor document.
  • Script bundle: Include resources with the script, such as icons or sounds.
  • Application: Create an app using the script.
  • Text: Save as a plain text file.