Subscribe to RSS

Sleep your Mac's Display Using a Script


Use Quick Look to Preview Files
Category: Rating:
+29
Author:
by Robert Bisson
If your Mac needs to do some automatically set up tasks in the night, it has to wake up from the sleep mode. This means that its display will switch on as well and distract its owner. However, AppleScript used together with Exposé allows you to put to sleep only the monitor while being not at the computer.
The following script moves the mouse cursor to the upper left corner of the screen, telling Exposé to put the screen to sleep:
do shell script "python -c \"import objc;bndl = objc.loadBundle('CoreGraphics', globals(), '/System/Library/Frameworks/ApplicationServices.framework');objc.loadBundleFunctions(bndl, globals(),[('CGWarpMouseCursorPosition', 'v{CGPoint=ff}')]);CGWarpMouseCursorPosition((0, 0));\""
tell application "Finder" to activate
To implement the script:
1. Go to the Active Screen Corners section of the Exposé preference pane.
2. Set the upper left corner to Put Display to Sleep.
3. Open the Applescript Editor to paste the above script into it.
However, the described method can interfere with your work while you’re at the computer, as every time you move the cursor to the top left corner of your Mac’s screen, it will “fall asleep”. So if it bothers or annoys you, try a free Sleep Display widget.

Share/Bookmark
Mac-How of the month
+587
by James Das

Help, care, protection – usually these words come to our minds when we think of 911. MacKeeper is like 911, but only for Mac OS world.