Check if App is running, don't run rule if it is

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I'm using Hazel in connection with nvALT for my note taking stuff. Based on a specific renaming scheme stuff happens with my note (like archiving etc.). I would like to have my rules run, when I am not running nvALT. My idea for achieving this, was to let Hazel check, if nvALT is running (just like Keyboard Maestro is able to do), but I couldn't find something built in. I thought this is probably a problem that has been solved, but I couldn't find anything in my searches.

Does anybody know a way, maybe a script, to test for if an App is running? Any help is appreciated.

EDIT (26.06.2013 - 22:07 ) : Never mind, I figured it out myself:

I've employed an apple script to test if an app (in my case nvALT) is running or not. If that app is running the script returns false (in hazel logic this means the file didn't match) otherwise it returns true:

Code: Select all
on hazelMatchFile(theFile)
   set nvRunning to is_running("nvALT")
   if nvRunning then
      return false
      return true
   end if
end hazelMatchFile
on is_running(appName)
   tell application "System Events" to (name of processes) contains appName
end is_running

It does work for me, may be it does for you, too.
Posts: 2
Joined: Wed Jun 26, 2013 3:09 pm

Return to Support