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