AppleScript is a scripting language created by Apple to easily control OSX applications. It is really simple to understand but sometimes is hard to find how to do something.
For instance, moving a running application in front of all other applications is pretty easy (once you managed to find who is responsible for that behavior and what keywords you need to use).
where the word
Finder could be the name of any application is currently running.