How To Save And Run The Scripts
Let’s use the Set the Location of Evernote Items With Google Earth script as an example. You can, of course, just cut-and-paste the source code from the “Code” box directly into your AppleScript Editor. For your added convenience, however, you’ll find some helpful links to the right of the source code box: “Open the Code in Your Script Editor” automatically opens the script within your computer’s default AppleScript editor, saving you the cut-and-paste. Have a problem saving the script or getting it to work properly? Use the “Submit A Bug Report” link to let me know!
For most people, clicking the “Open in Script Editor” link opens the script in a program called “AppleScript Editor” — an application that comes with every Mac. It’ll look something like the source code you saw in the box above the link, but its text will be purple. Purple text in AppleScript Editor means that the program hasn’t been “compiled” yet or, put another way, it means that AppleScript Editor hasn’t checked it out to verify that there aren’t any massive mistakes in our source code.
To have AppleScript Editor compile the code, you can either press the “Compile” button which checks the code without running it or you can press the “Run” button which will check it and then run it.
Saving the script is much like saving anything else on the Mac: The File Menu has “Save” just like many other applications you’ve used before. Select it and you’ll be able to select where your script gets saved and what it’s called. Personally, I like to save my scripts in the /Library/Scripts folder so that they’re available for every user account on my computer.
Save As Script or Application?
The only thing that you really need to know about the AppleScript Editor’s Save Dialog is that it gives you a choice to save your script in a few different formats. For our purposes here, you’ll save them as either a Script or as an Application. The difference between the two is pretty simple: When you open an AppleScript file saved in Script format, it opens the AppleScript Editor and you see the source code. This is the way you’ll want to save it if you intend to edit the code a bit and not just run it as written.
If you open an AppleScript file saved in Application format, opening the script runs it without opening it up in the Editor — or in other words, just like any other Application on your Mac. This is perfect for scripts that don’t need additional edits and which you’d like to run from a keyboard shortcut. ((Note–Some scripts require modification to run as Applications)
Hopefully, you’ll enjoy using the code library and these tools to build your own scripts. I’ve tried to make it as easy as possible for you to roll up your sleeves and get started but, if there’s something you think I’ve missed here, please let me know!