The Best Way to Prevent Mac From Sleep Step by Step Guide
With the help of AppleScript, it is possible to prevent MacOS from going to sleep mode. This has a significant advantage as it can keep your messenger status online, including popular messengers like Microsoft Teams and Slack.
To keep your messenger status online on MacOS, you can utilize the lock screen settings. However, this may not be sufficient. A script has been written to simulate user activity by pressing keys, tricking the Macbook into thinking that the user is still active.
Step 1: Launch the Apple Script editor
Click on Launch Pad
Search for Script Editor and Launch
Step 2: Copy and Paste the below code.
activate application "Google Chrome"
repeat 100000 times
tell application "System Events"
key code 55
end tell
delay 180
end repeat
Step 3: Click on Run to Prevent the Apple System to Sleep
Note: Optionally, you can save this script to awake.scpt and Run it as and when required.
Advantages of Keep Screen Awake using Apple Script
- No Admin permission is required.
- No need to install any third-party application.
- Keeps the Messenger status online (MS Teams, Slack, etc.)
Frequently Asked Questions
How do I stop my Mac from going to sleep?
There are two different way to stop your Mac from going to sleep
- Go to System Preferences > Energy Saver. Then tick the box next to Prevent computer from sleeping automatically
- Use the Apple script to prevent the mac from sleep.
How do I keep my Mac screen on all the time?
Using the AppleScript you can keep the Mac screen on all the time. AppleScript simulates the keyboard events and it will ensure your system is on all the time
How do I keep MS Teams Status always online (green) on Mac
The AppleScript in this article is designed for this purpose, This helps to Show your MS Teams status always online, even if you are away.
Follow me on LinkedIn https://www.linkedin.com/in/ganeshsirsi/