Disable Screen Sleep AppleScript Is there a way to turn screen sleeping on and off temporarily through AppleScript? I'm making a script at the moment that will run for a few minutes when I'm away, so I don't want it to sleep, but don't want to manually do it every time.
Certainly the easiest way to accomplish this is by using do shell script. pmset is definitely a viable option, though I am personally partial to the caffeinate command, which doesn't modify any preferences and doesn't require administrator privileges. You could use the following AppleScript to keep your screen awake indefinitely:

do shell script "caffeinate -di"


Alternatively, you can run caffeinate for a specified amount of time, after which your display will be free to go to sleep:

do shell script "caffeinate -dit [time in seconds]"