Application Objects
Lots of changes in the handling of application objects! Some have been needed for a long time, others were unexpected, but useful.
New properties
Application objects now have a running boolean property that lets you test for a running application without resorting to System Events. You can also test whether an application is frontmost using the frontmost property. Lastly, you can get an application’s version property without having to activate the application or send it any commands.
New behaviors
You can now target an application by its bundle identifier (“com.apple.mail” for example) or creator type (“emal”). This is useful for applications whose name may include a version number that changes from version to version. The phrases application “Mail”, application id “com.apple.mail” and application id “emal” are all valid references. This means that there is new id property for applications, so if you use set appID to id of application “Mail” you will get “com.apple.mail” in appID.
If you refer to applications by id rather than name, the app will continue to be found by Applescript even if the user has changed its name. But if you use this form and the application can’t be found, Applescript won’t ask the user to find it, it will throw an error (which you can catch with a try statement).
Other changes: Applications referenced in a tell block will launch hidden when commands are directed to them unless you specifically use launch or activate. Applications are located “lazily” which means they aren’t looked for until the script execution hits a tell block. This also means that applications are re-found each time they are referenced in a tell block, so that if an application is moved it will be found each time it is referenced. Apple’s release notes also say:
Apple notes that these new properties won’t cause errors with most applications in older versions of Applescript - Applescript will send the events to an application rather than handling them, assuming that they are application events. The release notes also say that most apps will handle name, version, and frontmost just fine in previous versions of Applescript, but that support for id or running would be rare.