Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

For those that are interested in the final script you can get it here

original question


I am trying to make a alarmclock script to wake me up. but I can't figure out how to change the screen brightness in automator.here is my workflow without brightness

I found a way to control brightness with the commandline. but I can't get it to work in automator

I'm the original author of the code listed in this hint. I originally wrote it for two reasons: first, to adjust brightness automatically by location on my iBook G4, which had no ambient light sensor, and second, so I could have my laptop turn on the backlight when a long operation finished, providing a quiet form of notification I could use while at a seminar. http://sabi.net/nriley/software/brightness.zip is 4-way universal, 10.5+. I compiled it under 10.6 with:... (see full forum page )

but when I try to use

brightness 0

or

brightness 1

I get an error in automator. error

am I using the run shell script wrong? could this be done easier in apple script? is there a alltogether easyer way to do this?

I need to turn the brightness up and down in automator how is this done?

Update I tried the apple script method you mentioned and it....showed the overlay that shows when the key is pressed but did nothing else

enter image description here

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Where did you install the “brightness” command? Even if you've set up your PATH in the shell rc scripts, it may not take effect for these commands because Automator isn't run from a shell. (You can set environment for all programs including GUI using ~/.MacOSX/environment.plist, but I wouldn't recommend fiddling with PATH just for this.)

I suggest changing your Automator workflow to use the full path to where it's installed, e.g.

/usr/local/bin/brightness 1
share|improve this answer
    
it is installed there as stated in above tutorial hints.macworld.com/article.php?story=20090901021817717 –  mjrider Jun 28 '11 at 16:46
    
@mjrider: I don't see a specific place mentioned in the main text, but I do see /usr/local/bin and /Library (not a good idea) mentioned. But neither of these places is in PATH by default, so you must use the full path to where you actually installed it. –  Kevin Reid Jun 28 '11 at 16:52
    
@kevin reid screencast.com/t/Od4RTdNt5NRY I did place it in /user/local/bin. I can run this command from terminal right off the bat without any other command. and it works find screencast.com/t/Bkyv91LPySN –  mjrider Jun 28 '11 at 16:57
    
That's because you have /usr/local/bin configured in your .bashrc or .bash_profile. Programs not running from a Terminal will not have these settings. Use the full path to the command in your Automator configuration. –  Kevin Reid Jun 28 '11 at 17:09
    
OOOHHHH so insted of "brightness 1" use "/usr/local/bin/brightness 1" IN THE SCRIPT in automator? (wasn't quite clear in your answer thats what you ment) –  mjrider Jun 28 '11 at 17:15

To use the command line way you tried, you have to install some software. You can download it, and find install directions, here.

Another option: You can run an AppleScript from your Automator workflow to press the brightness up/down keys. Up:

tell application "System Events" to key code 107

Down:

tell application "System Events" to key code 113

Note: you may have to Enable Access for Assistive Devices for the AppleScript to work.

share|improve this answer
    
I belive I have installed it...I CAN go to the terminal and say brightness 0 and have the screen go dark... but it won't work in the script...but I will try this other way and let you know –  mjrider Jun 28 '11 at 3:51
    
also when I use either of those scripts I JUST see the sun that shows how bright the screen is...without it changing at all... =( I think I am doing something wrong... –  mjrider Jun 28 '11 at 4:02
    
@mjrider Can you take a screenshot of just the Run Shell Script action for me? That's weird with the scripts; they now do that on mine too. I wonder why they aren't working... –  Nathan Greenstein Jun 28 '11 at 13:30
    
screencast.com/t/f6g9CSMDmf8 I get the same results if I use "pass input as argument" –  mjrider Jun 28 '11 at 15:17

Try having the automator run this AppleScript. It works for me!

set brightness_level to 1.0

tell application "System Events"
    tell application "System Preferences" to reveal the anchor "displaysDisplayTab" of pane named "Displays"
    tell slider 1 of group 1 of tab group 1 of window 1 of process "System Preferences"
        set value to brightness_level
    end tell
end tell
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.