Although you can get basic info on how to script a particular application and the Finder itself from its AppleScript Dictionary, I find that all too often the descriptions given are lacking. That is why I have included my own dictionary here to clarify. However, if you would like to see an specific dictionary, all you have to do is open the Script Editor and choose “Open Dictionary…” from its File Menu and choose the application from the dialog.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Tips on Reading and Understanding AppleScript Dictionaries
Before you Get Started, I Highly Recommend that you Take a Quick Look at these Comments on Dictionaries
An entry taken from the AppleWorks 6 Dictionary:
make v : Make a new element
make
new type : the class of the new element.
at location specifier : the location at which to insert the element
[with data any] : the initial data for the element
[with properties record] : the initial values for the properties of the element
–> specifier : to the new object(s)
Some things to note about dictionary entries
1) The first line, make v : Make a new element, is the basic definition of the term
2) The second item in the first line in italics (v here) describes the term as an English part of speech, here, a verb. This is significant, because AppleScript is written basically like sentences in English.
3) Text in bold is to be written literally
4) All plain text is not to be taken literally and is a description of the element or term in bold.
5) Text within straight brackets are optional parameters that may not apply for what you want to do.
6) Blue, underlined text is a link to a further definition of the term or attribute.
In the ‘make’ example above (omitting optional stuff), you could say:
make new document at desktop
Alias – A MacOS path reference to the location of a file or folder. Something like: alias “Macintosh HD:Users:administrator:Documents:”
Block – Instructions or statements that are grouped together such as tell application “Finder” … end tell or repeat … end repeat etc.
Conditional – A group of optional instructions where the user must make a choice, for instance: if clientName is “Bill” then … else if clientName is “Betty” … else … end if etc.
Current Date – Returns something of the form: date “Sunday, June 14, 2009 8:05:31 PM”. To extract just the date from ‘current date’ say: date string of (current date). Results in: “Sunday, June 14, 2009″
File Type – Represents a four character code that identifies the kind of document, for example: “CWWP” – an AppleWorks 6 text document.
Front Finder Window – The currently active, visible window. In the hierarchy of open windows, this is the window at the very front. It has a reference of 1, it can be referred to as finder window 1
Offset – Identifies the numerical position of a specified text character within a specified text string, as in (the offset of “i” in “Bill”, which would return 2 since ‘i’ is the second character found in “Bill”.
Path – Get location of a file or folder on your computer, as in: path to desktop – results in something of the form of: alias “Macintosh HD:Users:administrator:Desktop:”
POSIX Path – POSIX stands for Portable operating System for UNIX. A POSIX path gives a UNIX path reference to a file or folder.
Property – A sort of variable that typically sets initial values for a document, for instance in AppleWorks 6 it usually takes this form: properties {name:”Document 1″}
Result – A sort of temporary variable that ‘results’ from a script execution such as a dialog. Actually, the result is a record containing bits of information separated by commas that can be saved in variables for further script execution.
Selection – The object which has just been selected, such as in: select paragraph 1, It can be just about anything that you would be able to select to move, delete, duplicate etc.
Tell – The Tell command directs a statement or block of statements to a specific object, most commonly an application, as in ‘tell application “Finder” to activate’ or ‘tell front document to select paragraph 1′
.
Text Item Delimiters – A keyboard character usually a comma or other punctuation, used to separate different pieces of data. Full synyax is something of the form ’set AppleScript’s text item delimiters to “,”‘. Often in lists or records such as {”Peter”,”Paul”,”Mary”}. Here, if a comma is used, text item 2 would be “Paul”.
Try – The Try statement asks the target to attempt to execute a statement or group of statements. If an error occurs, it is intercepted and another course of action may be invoked. Full syntax: try…statement(s)…on error…error handler…end try.
Variable – A container which holds a value, which is usually assigned with ’set’ or ‘copy’
































Recent Comments