Checking brightness?

Is there any way to check brightness? i’m used to having the screen turn off when i set brightness to the lowest setting, but ever since i got an iMac, that doesn’t work anymore. I’m trying to make something to check the current brightness, and if it is at it’s lowest setting, it’ll turn off the screen.

Browser: Safari 537.36
Operating System: Mac OS X (10.10)

Compile https://github.com/nriley/brightness/

Then use something like

set theBrightness to (do shell script "brightness -l | awk 'FNR == 2 {print $4}'")
-- brightness -l | awk '/brightness/ {print $4}'

The docs say this is not compatible with OSX as of 10.9, however I just installed it via Macports.

It seems to work alright, although it produces a plist instead of plain text when using the verbose switch.


Chris


{ MacBookPro6,1 · 2.66 GHz Intel Core i7 · 8GB RAM · OSX 10.11.1 }
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

You can store the plist in a var if you need to (no key for actual brightness though) and then read whatever you need from AppleScript.

http://www.macosxautomation.com/applescript/features/propertylists.html
https://web.archive.org/web/20120201171133/http://www.j-schell.de/node/316