AppleScript trick

If you have multiple copies of the same application on your hard disk, it can be a bit unpredictable which one will launch if you say
tell application "MyApp" to activate
in AppleScript.
Here is a code snippet I figured out for making sure it is the one in the /Applications directory that gets launched.
set mypath to ""
tell application "Finder" to set mypath to path to the "apps" from system domain as string
set mypath to mypath & ""
tell application mypath to activate

3 thoughts on “AppleScript trick

  1. So what exactly is the advantage of having multiple copies of the same application on your hard drive?

  2. Developers often build multiple versions of the same application. One version is usually “Debug”. This version runs more slowly, and is much larger than the other, “Release” version. The “Release” version is what you ship to customers. But, the “Debug” version can be debugged via a tool called “the debugger”. The debugger allows you to step through the source code for the program, and allows you to inspect variables, threads, the stack, etc…. Debug versions are crucial for tracking down strange behaviors in new programs.

Leave a Reply

Your email address will not be published. Required fields are marked *