I recently installed Mira, which lets me run commands/apps/applescripts by a press of a button on the remote. What I want to do here is set up a simple applescript to check if an app is open, and if it is, close it, but if it's closed, open.

So, basically, the sort of syntax in a C-style language:

Code:
if (app.opened() == false)
  app.open();
else
  app.close();
Can anybody shed some light on how to do this? I've been googling it for a bit, cand cannot come across much to see if an app is open or not.