Applescript is a Macintosh product that lets you write your own scripts or applications to handle your everyday maintenance procedures. That's one reason to use Applescript, but there are others as well. Unfortunately, as is well documented on the web, Applescript is difficult to use because it's Apple's attempt as creating a "human-like" language to do programming. Sometimes I find that annoying, especially when it comes to text manipulation.
But now Apple has introduced a new wrinkle, making it even more difficult to use, especially when you're trying to write transportable applications. By that I mean applications that you would like to run in Tiger (10.4) and Snow Leopard (10.6), or any other Mac OS X versions. Up through Leopard (10.5), you could write Applescripts, compile them, and save them as "applications", and they were simply an executable file (type-f), NOT a directory (type-d) with "Contents". Then in Snow Leopard, the "Script Editor" was replaced by "Applescript Editor" which produced "applications" that looked like 3rd party applications contained within a "Contents" directory inside an enveloping directory. Therefore, your application was no longer a type-f file, but was a type-d directory instead.
Darwin scripts that you wrote for use in Terminal.app, which may have tested for the existence of your Applescript application, probably did this:
If [ -f "/Applications/MyApp.app" ] ; then
osascript "Applications/My.App.app"
fi
The problem in that if-statement is the "-f" operator. In Snow Leopard, your application isn't type-f file anymore. You could switch to "-d" to test for a directory, but now your Darwin script isn't transportable. What I found worked was to use "-x" instead, because your application is "executable" anywhere.
But Snow Leopard presented another incompatibility. If you had Darwin scripts launched by a "crontab" entry, and they executed a type-d Applescript application, they didn't execute properly. The "crontab" facility has a list of jobs you wish to run at specific times, with no Terminal interface. That doesn't mean you can't display dialogs or manipulate browser windows, you CAN do those things because either Finder or your browser application is providing the dialog or window. But for some reason, Snow Leopard won't run an Applescript application of type-d. It still runs those of type-f without error.
So, what I had to do, to maintain transportability, was copy "Script Editor" from Tiger to Snow Leopard, and compile some of my Applescript applications with that older mechanism, and save them as type-f applications. These would still run from "crontab" submitted Darwin scripts which, in turn, executed the target application using the "osascript" command. This use of a Darwin script to launch any Application is just the reverse of Applescript's "do shell script". In fact, you can chain together any combination pre-compiled applications and Darwin scripts.
Snow Leopard had another complication when both "AppleScript Editor" and "Script Editor" were present. Both have the same "signature", and if you tried to double-click on a .applescript file, only "AppleScript Editor" would launch. I tried using the Get Info window to select "Script Editor" for a .applescript file, and then click on "Change All...", but that didn't seem to do anything. That one file would launch "Script Editor", but not the other .applescript files. What I do now is first launch "Script Editor", and then "Open" the .applescript file directly.