Script to make LCD/Display sleep only

I am lookng for a script, or help making one that will make the display sleep instantly on command. My problem is I have my mac in my bedroom, but I want to leave it on, so I can not put it to sleep normally and I dont want to change the display sleep to some small number because I dont want it sleeping on my while i am not looking at the screen. Can any one help??

Thanks,
Phillip

Once you have Speech Recognition set up to receive voice commands, save this script as ‘Sleep’ in the Speakable Items folder. Then, when you want the computer to sleep, say “Computer sleep”, where “Computer” is the computer name as defined in the Speech preference pane. This might vary depending on how you have it configured to recognize commands.

tell application “System Events” to sleep

Update: On further consideration, this probably doesn’t address your need since it puts the computer to sleep and not just the display.

I use this script with dockables, I had to change the name of the dockable app “Sleep Display” to “Sleep Display Now” because it would run some other app that I have installed and then close (not sure what app it was addressing).

http://getdockables.com

I have it set to repeat because something keeps waking my display in the night and with two 28" monitors in the bedroom my wife isn’t too happy when the computer comes on. I keep waking up thinking it is morning!

Obviously the simple control+shift+eject works too but accessing the eject key via Apple Script seems futile, hence why I have the script access dockables.

Dockables is just applescripts from what I can tell but how they put the display to sleep is beyond me at this point in my newbie state.

set theCounter to 10
set theInterval to 1
repeat until theCounter is 0
	display dialog "Your display will sleep in aproximatly 15 seconds." & return & return & "Time Remaining: " & theCounter & " seconds" as text buttons {"Cancel", "Sleep Display Now"} default button 2 giving up after theInterval
	set theirChoice to the button returned of the result
	if the theirChoice is "Sleep Display Now" then
		
		repeat
			tell application "Finder"
				display dialog "Your display output will now turn off but not your computer." buttons {"Cancel", "Sleep Display"} default button 1 giving up after 5
				set the button_pressed to the button returned of the result
				if the button_pressed is "" or the button_pressed is "Sleep Display" then
					tell application "Sleep Display Now"
						launch
					end tell
				end if
			end tell
		end repeat
		
	else
		
		set theCounter to theCounter - theInterval
	end if
end repeat


repeat
	tell application "Finder"
		display dialog "Your display output will now turn off but not your computer." buttons {"Cancel", "Sleep Display"} default button 1 giving up after 3
		set the button_pressed to the button returned of the result
		if the button_pressed is "" or the button_pressed is "Sleep Display" then
			tell application "Sleep Display Now"
				launch
			end tell
		end if
	end tell
end repeat


With dockables and changing the name of the app “Sleep Display” to “Sleep Display Now” this should do what you are after. Too bad it is not self contained and depends on another app though.

tell application "Sleep Display Now"
						launch
					end tell

Using the open or activate command would give an error since it isn’t meant to stay open.

Oh Cool! Awesome, job thanks for posting! :smiley: