How to check if Application is running in Applescript
Hello,
due to the lack of ability to turn off the display on an iMac, I am forced to use a 3rd party application called "Shades" to greatly dim the display when using Airplay or watching a movie on my second monitor. Due to the odd way Shades operates, the application will dim the display to the previous settings on login. Therefore every time I login, my display goes dark and I must use a keystroke defined by Shades to restore the display brightness.
I have written an Applescript to remedy this:
do shell script "sleep 4"
tell application "System Events" to key code 27 using command down
quit
The problem I have now is: if I was not running shades on my last session, when I login, the Applescript gives this error:
“Application isn’t running.”
Is there an Applescript command (or shell command I can run withing Applescript) to check if Shades is running before executing the rest of the script?
iMac, 14,3 21.5, 16GB DDR3 256GB-OTHER, OS X Mavericks (10.9.5), i7 4770s 3.1GHz Quad