Hello,
I am trying to caffeinate my computer during work hours + a bit more, so I want to do it from 8am to 7pm. I am able to manually do it by typing these commands in the terminal:
$ caffeinate
$ killall caffeinate
But I want to do that automatically.
I have something like this, but I don't know where to save it and what to do with it:
Does anyone know how to do that?
Thanks, BossElijah
I am trying to caffeinate my computer during work hours + a bit more, so I want to do it from 8am to 7pm. I am able to manually do it by typing these commands in the terminal:
$ caffeinate
$ killall caffeinate
But I want to do that automatically.
I have something like this, but I don't know where to save it and what to do with it:
AppleScript:
-- If today is not weekend, and it is 8:00am, caffeinate.
on idle
set currentTime to current date
set eightAM to 8 * 60 * 60
if the weekday of currentTime is not Saturday and the weekday of currentTime is not Sunday then
if the time of currentTime is greater than eightAM and the time of currentTime is less than (eightAM + 60) then
do shell script "caffeinate -t 39600 &"
end if
end if
--only check once a minute
return 60
end idle
Does anyone know how to do that?
Thanks, BossElijah
Last edited: