Make a Program in AppleScript

AppleScript is a powerful English-like scripting program that allows the user to make applications, from helpful math solvers to games. This how-to will show you the basics of AppleScript and how simple it is compared to, say, batch.

Steps

  1. Locate the Script Editor. The Script Editor should be under AppleScript in the Applications folder.
  2. Learn to search for commands easily in its dictionary. Go to File>Open Dictionary. Select AppleScript application. A window with AppleScript's dictionary will open up and you can search for all the commands you need.
  3. Know what the icons in the header are for. Stop stops the recording. Run runs the script. Event Log History shows the history of usage of your script. Result History shows what happened during the time the script ran. Print prints out the script. Bundle Contents bundles the commands in the script.
  4. Learn to save files in different formats. To do this, go to File>Save As. Click on File Format and choose the type of format you need. This is needed for different purposes.
  5. Learn simple commands, like the beep command, talk command, and the dialog command.
    • Beep command, type: beep
    • Beep multiple times, type: beep 2 (any number can be used)
    • Talk command, type: say "enter text"
    • Dialog command, type: display dialog "enter text"
  6. Learn to use the Script Assistant. It's very useful and handy when you're typing a long and complex program. To get the Script Assistant, go to Script Editor > Preferences. Click editing. Select Use Script Assistant. Quit and reopen Script Editor. Now when you type a command, an ellipsis appears next to it, completing the word. Press F5 to show all the terms possible. Press Enter on the term you need.This makes scripting much easier and faster.
  7. Search the internet. There are many websites about AppleScript.
  8. Read books! There are many great books on scripting.

Tips

  • Be sure if you do publish a program, that you go over with a fine-tooth comb and fix out all the kinks.
  • Try to make something useful, like a password maker or math problem solver.
  • Try to make the code more fluent and compact. Try squishing a three line code into one command if you can.
  • Check out how other programs written in AppleScript so you can see how those program commands are typed. To do this, search for "Example Scripts" or look in your AppleScript folder for "Example Scripts".
  • Save often.

Warnings

  • Do not create destructive programs.
  • Try not to beep too many times, as the user may get annoyed.

Things You'll Need

  • A Macintosh Computer
  • AppleScript Editor
  • Keyboard
  • Mouse

Related Articles