Go Back   The macosxhints Forums > OS X Help Requests > System



Reply
 
Thread Tools Rate Thread Display Modes
Old 03-31-2010, 03:17 AM   #1
atoxx
Triple-A Player
 
Join Date: Dec 2008
Posts: 60
Force Snow Leopard to auto sleep?

Hi since SL i can't get my iMac to autosleep regarding the Power Management settigs i have(1 Minute)

Hoped this would be fixed with 10.6.3 but no luck
Tried to follow all suggestions on Google like file sharing, bluetooth, removing MacFuse and more but still no luck, tried PleaseSleep and Narcolepsy but they force the iMac to Sleep even when i move the mouse, so they just trigger the sleep no matter what you do, so i now tried this to achive this with an Applescript and Screensaver to check on launch if System idles and then if yes to sleep but nothing happens, found this script on the web, but maybe there is something wrong with it?
If someone has an idea how to use this it would be great if he could tell me

The Script i already have (Not working at)

PHP Code:
property idleTest 60 -- How long to be idle (in secondsbefore activating script

on idle_time
()
    -- 
this is the crucial line that I don't claim credit for
    set idleTime to (do shell script "ioreg -c IOHIDSystem | perl -ane '
if (/Idle/) {$idle=(pop @F)/1000000000; print $idle,\"\";last}'")
    return 
idleTime
end idle_time

script should_quit
    set idleComp to false
    
-- this repeat loop polls the idle time every 30 seconds to determine
    
-- whether the system has been idle for the number of seconds defined above.
    -- 
It will repeat indefinitely until the idle time is acheived
    
-- whereupon the action is performed
    repeat 
while idleComp is false
        set idleTime to idle_time
() of parent
        set old_delims to AppleScript
's text item delimiters
        set AppleScript'
s text item delimiters to "."
        
set idleTime to ((first text item of idleTime as string) as integer)
        
set AppleScript's text item delimiters to old_delims
        set idleTest to (idleTest as integer)
        if idleTime is greater than idleTest then
            set idleComp to true
            -- put your sleep actions in here
            ignoring application responses
                tell application "System Events" to sleep
            end ignoring
        else
            delay 5
        end if
    end repeat
end script 
atoxx is offline   Reply With Quote
Old 03-31-2010, 07:39 AM   #2
benwiggy
League Commissioner
 
Join Date: Aug 2006
Posts: 5,038
Sleep works fine for me, so I doubt that this is a problem that a system update would solve.

Perhaps there is something stopping the Mac from going to sleep?
What software/processes do you have running?
What additional hardware do you have?
benwiggy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 12:53 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.