DekGenius.com
[ Team LiB ] Previous Section Next Section

13.9 Application

The application class is used primarily to specify a target. You construct an application object using an object string specifier—the word application followed by a string representing the application's name or pathname. An abbreviation for application is app.

On Mac OS X, sometimes the application's name isn't what you think it is. The tendency is to glance at the Application menu at the upper left when the application is frontmost, or to look at the application's name in the Dock, and imagine that this shows you its real name; sometimes it doesn't. For example, Excel's name is "Excel" in both the Application menu and the Dock, but its real name is "Microsoft Excel".

If an application is targeted by a tell block, AppleScript must be able to find the application in order to compile the script. You can use a full pathname instead of just a name, to help it; but you shouldn't usually have to do this. (There is sometimes good reason to use a full pathname, though, such as to distinguish two versions of the same application on your machine.) If you get the name right, AppleScript searches for the application, and it usually finds it remarkably quickly. See Section 4.4.3 for what happens if you get the name wrong.

AppleScript may launch the application at compile time if it isn't already running. This is usually because otherwise it can't access the application's terminology (because its dictionary is marked as dynamic). See Section 4.8.

See Section 19.1 for more on resolution of terminology, and on the use of the application class to represent the top level of an application's object model.

    [ Team LiB ] Previous Section Next Section