|
![]() |
Basic AppleScript Terminology |
AppleScript is not a difficult language to learn. Its plain English approach of "talking" to applications and elements is easily understandable. However, like any language, there are some variations in the words you can use; dialects, if you will. AppleScript is implemented by the developer of an application, so the commands and parameters may be conceptually the same as another application's, but using a different term. This is certainly not meant to be a complete guide to AppleScripting DEVONthink, but what follows are some common terms or concepts you're likely to encounter. The examples here and in this chapter are meant to give you basic ideas about scripting DEVONthink. Talking to DEVONthink In AppleScript you "talk" to programs like DEVONthink using a
DEVONthink's dictionary AppleScript-capable applications have their commands, elements, and properties listed in an AppleScript dictionary. DEVONthink includes a large dictionary as a great reference for you. To view the dictionary, open the Script Editor application, select File > Open Dictionary and choose DEVONthink in the appearing window. You can also add DEVONthink to your Script Editor library. Select Window > Library, click the + button and choose DEVONthink. This way you keep DEVONthink's dictionary at hand. Note: The use of the is almost always optional, but including it can make the script seem a bit less robotic. For example, both lines in this script are functionally the same:
As noted above, the dictionary is the best place to find specific terminology to be used with DEVONthink. However, here are two things to understand: Records: Every item in a DEVONthink database is a record, a record with properties. Do a search for "record" in the dictionary and you'll see it's a fundamental unit with a wide range of properties associated with it. This means you won't be writing code like, There are many commands specifically for use with records: Parents and Children: Another concept to understand is parents & children. Generally speaking, these classes deal with the container or the contents of some object. The parent of an object is the group containing it. The children of a group are the immediate contents of that group, i.e., it does not list the children of sub-groups. Children can be documents or groups; parents will only be groups.
Using Locations One of the common tasks people want to perform with AppleScript is importing files to a specific group. In order to direct the files to a given location, you need to reference it properly. Below are three general options for choosing a location:
There are many times you want to direct files into a specific group. That group may not be the current group you're in and you may not want to choose a destination each time. Here are two common ways of specifying a particular group in your database to be a destination group in your script:
Working with a selection Many times you want to process items you have selected in DEVONthink. Perhaps you want to generate a list of names and dates for use in a document you're working on. Below is a handler commonly seen in DEVONthink scripts:
|