Stopping a sleep

Hey guys, Does anyone know how i would make a applescript that prevents a machine from going to sleep like when the screen is closed?

There are several kinds of sleep and you don’t specify which you’re trying to prevent. In the Energy Saver Preferences pane you can put the computer (cpu) to sleep, the display to sleep and the hard disk(s) to sleep. In addition, in the Desktop and ScreenSaver pane, you can set how long before the ScreenSaverEngine starts to display your chosen saver. By “when the screen is closed” however, you might mean closing the cover of a laptop. Can you be clearer?

hi sem,

if you just want the display to sleep, but not the HD, and you want it to be done from a script, the command line program, “pmset” is excellent for this kind of stuff.

there are a couple of differences between versions of OS X but they are pretty well documented. do a “man pmset” in the terminal to find out more.

well at the moment my program “MultiAlarm” is a alarm which is set off by movement, the only problem is someone can easily just close the screen on a laptop and the machine will sleep (the sleep where everything but ram is turned off and the light flashes)

What i want is so if they close the screen when its armed it wont goto sleep but the screen can be closed and it will sleep if it isnt armed

any ideas?

sorry, not really a solution for your problem, I am afraid … but I think some time ago I read somewhere (apple mailing list?) a discussion about running a powerbook with closed display. I think it is possible to do this when an external monitor is connected, but Apple does not recommend doing this due to thermical reasons - so even if you find a solution, this problem probably remains …


I was looking for the same thing because I wanted to be able to continue staying on AIM and listening to iTunes when i closed my laptop…having just converted from PC, it was almost unreal to me that you couldn’t do this in the settings (since this is like second nature on a pc). However after doing some research and downloading a program, I came to find that the reason you can’t do it is because mac laptops run too hot and it can be damaging to your screen and laptop if you leave the computer running while the lid is closed. It’s almost not really worth it just so you can run your the alarm, I would advise to get a lock for your laptop since that’s safer anyways. I mean think about it, how many car alarms to you hear go off in a day that no one pays attention to…don’t take risk with your mac. However, if you’re still interested in downloading the program, goodle “Sleepless Mac” and it should be the first hit. Good luck!


Model: Macbook Pro (second release)
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)