1

I would like to create an automated brightness/dimming chase on my Mac OS Yosemite 10.10.5 using Applescript,

I found this script>>

Dimmer: tell application "System Events" key code 107 end tell

Brighter: tell application "System Events" key code 113 end tell

What I would like to do now is to repeat that action and control the speed/timeframe of the dimming,

Any Applescript expert able to help on that?

Thanks!!!

1

Only because you asked... The code below is an example of using a repeat statement and delay commands with your code.

That said, I do not believe it is going to give you the desired results because while the events will trigger in code nonetheless they'll probably not be processed at the hardware level. (It doesn't on my system.)

You can change the numeric value in the repeat statement to suite your needs. The value is an integer, as in repeat integer [times].

The delay command shown in decimal seconds as in delay number being the number of seconds to delay. The number may be fractional, such as 0.5 to delay half a second.


repeat 3 times
    repeat 10 times
        tell application "System Events"
            key code 107
        end tell
        delay (0.1)
    end repeat
    repeat 10 times
        tell application "System Events"
            key code 113
        end tell
        delay (0.1)
    end repeat
end repeat
  • Hey cool, thanks !!! this is really helpful! I'll just play with the value now – Salomé Bazin Jul 29 '16 at 10:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .