Nope. I‘ve started by modifying scripts. That was far from ideal.
Here are some things that could be useful.
How to get started with writing AppleScript
-
Don’t modify existing scripts.
Read and try to understand the steps taken in a script, then start writing your own. -
Do use descriptive variable names.
Using self-explanatory variable names makes it easier for you to understand what your script does while writing it and in the future. It also makes it easier for other users, e.g. when you post one that you need help with. You’ll often find variable names used in someone else’s script cryptic or not descriptive enough. Change these to your own when you write your script. -
Do use comments.
--
or#
in front of a line comments it out. Use them to deactivate code while testing something or to add your comments. -
Start every script with a short description of the desired outcome.
How to get started with searching
-
Use e.g. startpage.com to search for
AppleScript
plus the command or idea you have.- Do not rapidly scan search results
Even if a result doesn’t seem to answer your current question there’s a value in reading it. This way I’ve found countless things I didn’t know were possible. - Do not skip results that seem to rely on an app you don’t use.
There’s value in reading them too. See above. - Capture what could someday be of interest.
Create a group in DEVONthink and simply store everything in it. Use a searchable format, e.g. webarchive.
- Do not rapidly scan search results
-
Searching in an app’s forum is different.
- Don’t search for
AppleScript
.
In my experience most posts that include an AppleScript do not contain the term “AppleScript”. Instead you’ll find posts of users asking for a script. - Do search for something that’s part of almost all scripts, e.g.
tell application
- Don’t search for
How to get started with understanding what happens in a script
-
Download Script Debugger.
-
Read Script Debugger’s help.
-
Use Script Debugger’s Results & Variables Tab
-
Try
-
Try
-
Try