I think you're misreading the document, I don't think you actually have to instantiate an NSTask in order to compare whether another application is running. You would just do something like this:
Mail = Application('Mail')
if (Mail.isRunning) { ... }