Switching Energy Saver on login

Hi,
I would like to automate the following: switching Energy Saver to Highest Perfotmance when a specific user (non admin) logs on and switching back to Automatic once the user logs off.
I found this thread ( http://discussions.apple.com/thread.jspa?messageID=1289296&#1289296 ) which also deals with the energy saver thing, but beeing a complete novice to apple script, I would greatly appreciate if anyone could walk me through the details..
Thanks a lot,
Alex
PowerBook G4 1.5   Mac OS X (10.3.9)  

I use a program called "Jiggler" to prevent screen sleep (it runs the mouse around in a tiny circle just often enough to prevent the ScreenSaverEngine from starting.
I start that with an AppleScript that (in part) looks like this:
-- start of script ---
activate application "Jiggler"
-- this sets screen sleep time to never and spindown to never - the smallest setting is 1 minute = 1
do shell script "sudo pmset dim 0 spindown 0" user name "PutYoursHere" password "YourSecretHere" with administrator privileges
-- this wakes up the hard disk if it was asleep - it just writes some disk info to temp, but has to start the disk to get it.
do shell script "diskutil info \"POSIX path to disk\" > /dev/null"
--- end of script ----
I do other things as well. Note that this is not secure because your password is hanging out - it works for me because you can't run it unless you log in and only I use the machine. If you save it as an application and put it in your startups it will run do its stuff and quit.
To restore the settings I use another script:
--- start of second script ---
ignoring application responses
quit application "Jiggler"
end ignoring
activate application "ScreenSaverEngine"
delay 3
do shell script "sudo pmset dim 1 spindown 1" user name "YoursHere" password "YourPW" with administrator privileges
--- end of script ---
Again, I do several other things. This turns on the screensaver immediately and then 1 minute later powers down the the drive and in my case monitors. Not sure what happens on a laptop.

Similar Messages

  • C5 doesn't switch back from energy save modus when...

    When the battery is low the c5 auto switch to energy save modus. When you charge the phone it normally switches back to regular modus. Now it is only possible when I reset it to factory settings each time. The problem started after the last update. Does anybody have the same problem? Or does anyone know how I can do this manually.

    Fantasy thank you for response. I wonder if someone from BlackBerry is actually working on solving this. Another Z10 user said he was able to avoid the battery pull by just turning wifi off when he went out of wifi coverage. I haven't personally tried this solution though.

  • Energy Saver Shut Down Schedule Problem

    I have Tiger set to Shut Down at 4:00 AM but when I wake up in the morning, the computer is still on, only it's not logged in. It is at the login screen (I have automatic login turned off). Now, I'm not sure if it's restarting the computer or simply logging out so in order to test it, I change the Shut Down time to about a minute in the future but the computer doesn't do anything! Does anyone have an idea?

    Your uptime results show that the computer is not switching off.
    For example,
    9:56 up 9:44, 2 users, load averages: 0.23 0.24 0.23
    ... means it's now 9:56am and the computer has been up for 9 hours and 44 minutes.
    Don't worry about the "2 users" - every individual terminal window is an additional login (unless you have actually changed the default setting). Forget about the load average too - this is just referring to how busy the CPU has been.
    Another check you can run is to run this command in the terminal:
    last | less
    The 'last' command shows all the logins, shutdowns and reboots performed on your computer. Piping that command through 'less' just allows you to page through the results. Do you see a regular "shutdown" at 04:00?
    You can start off with the obvious mistakes and check that in the Energy Saver schedule you haven't got a contradictory "Start up or wake" time set.
    You also need to bear in mind that when altering the schedule, you need to reboot the Mac once for the settings to take effect, so don't expect to change the setting to 1 minute in advance and see the computer shut down at that time.
    The most likely problem is that your computer has already gone to sleep before 04:00 and therefore cannot shut down (see http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1614.html). In Energy Saver, check that the slider labelled "Put the computer to sleep when it is inactive for" is all the way to the right to indicate "never".
    Another common problem is that you have some software running that is preventing your computer from shutting down. Do you see any warning windows on your desktop when you come back to your computer in the morning? If any software is in the middle of an operation when the automatic shutdown commences, you should see a warning pop-up. Unless you intervene at this point, the computer will not shut down. I have occasionally come back to my Mac in the morning to find a warning window asking whether I want to save and quit or similar.
    Finally, another possibility is a hidden background process that is preventing the system from shutting down. If this is the case, then it gets a bit more tricky. You need to view the system log in the terminal:
    less /var/log/system.log
    and look at what happens around 04:00 every day. Are there any errors that complain about shutdown?
    That's all I can think of right now - my bet is that your computer is going to sleep before 4am, which prevents the automatic shutdown.

  • How do I save changes to "Energy Saver" that stay in effect after rebooting.

    I have changed the sleep settings for the hard disk and display for my iMac but after I shut down and the start up again, the settings are back to the default settings.  How can I save these changes and avoid having to do this change every time I boot up?
    Tim

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device.
    Set the Energy Saver preferences the way you want them.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output andWi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Check the settings while in safe mode. Have they been reverted? If so, set them again. After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Energy saver keeps coming unlocked... sleep won't work

    I've noticed when I arrive in the morning that my Mac Pro is awake.  But the Time Machine log shows it had been an entire hour since TM was active.
    I researched various places (including here) and deleted the preference for com.apple.PowerManagement.plist.
    But the problem persists.  What's more mysterious is that even though I lock the energy saver padlock, when I go back the next morning it is unlocked.
    Any idea what's going on here?

    Test after each of the following steps that you haven’t already tried:
    Step 1
     ▹ System Preferences ▹ Energy Saver ▹ Power Adapter ▹ Wake for network access: uncheck. You may need to unlock the preference pane by clicking the lock icon in the lower left corner and entering your administrator password.
    Step 2
     ▹ System Preferences ▹ Energy Saver ▹ Schedule… ▹ Start up or wake: uncheck
    Step 3
     ▹ System Preferences ▹ Print & Scan ▹ Open Print Queue...
    Check all printers for unfinished jobs. Deal with any you find.
    Step 4
    Disconnect all wired peripherals except keyboard, mouse or trackball, and monitor, if applicable.
    Step 5
    Launch the Activity Monitor application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Activity Monitor in the page that opens.
    Select All Processes from the menu in the toolbar, if not already selected. Enter “powerd” (without the quotes) in the "Filter" text field. Select the powerd process and click the Quit Process button in the toobar (stop-sign icon.) In the sheet that opens, click Force Quit. You’ll be prompted for your administrator password. The process will be relaunched immediately.
    Step 6
    Boot in safe mode and log in. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Note: If FileVault is enabled under Mac OS X 10.7 or later, or if a firmware password is set, you can’t boot in safe mode.
    Safe mode is much slower to boot and run than normal. Don’t launch any applications at first. If sleep still doesn’t work properly, back up all data and reinstall the Mac OS. After that, if you still have the issue, make a “Genius” appointment at an Apple Store to have the machine tested.
    If sleep now works as expected, go on to the next step.
    Step 7
    Still in safe mode, launch the usual set of applications that are running when you have the problem, including your login items, one at a time, testing after each one. Some applications may not work; skip them. You might be able to identify the cause of the problem this way.
    Step 8
    If sleep is still working after you’ve launched all the usual applications, reboot as usual (not in safe mode) and test again. If sleep still works, you’re done, at least for the moment.
    If you still have the sleep issue after booting out of safe mode, post again.

  • The Energy Saver in System Preferences has no effect.

    Hi,
    I have my Energy Saver preference set to turn off my monitor after 20 minutes of idle time.  But the display never goes off.
    Energy Saver used to work, now it doesn't and I have no idea why not, or what changed.
    Any ideas?
    Thanks!!

    Perhaps you have some process keeping it awake for some reason.  Have you installed any new stuff recently?
    Try smc and pram reset.
    Open terminal and copy/paste the following line, hit return, post the results:
    pmset -g
    Also post the files in the following places:
    your login items
    ~/Library/LaunchAgents (in your home directory)
    /Library/LaunchAgents
    /Library/LaunchDaemons
    /Library/StartupItems
    And again in terminal the output from the following line (copy/pasteand hit reutrn):
    kextstat -kl | awk ' !/apple/ { print $6 $7 } '
    Maybe some of this info will indicate a possible culprit.

  • Shortening Energy Saver Shut Down Time?

    We have a Keynote project where the presentation is on a Mac-Mini and it automatically starts and stops at set times using Energy Saver and Automator as part of a big display in a local Museum.  The presentation starts up great at its designated time but when Energy Saver goes to shut down, it takes literally 10 minutes. I would like to shorten this to something like, one minute.  Any suggestions?
    Here's the setup:
    I have the Mac-mini set to automatically start up every day at 9:00 am and shut down at 5:30 pm
    The Keynote presentation is set up in Login Items to open at startup and it does.  Once it loads, it automatically begins playing the presentation and loops throughout the day.
    At 5:28 pm, I have an Automator script that shuts down Keynote (otherwise, the program will not let the Mac shut down). This Automator script is in iCal and is scheduled for every day.
    The Automator script shuts down Keynote and a couple of minutes later, Energy Saver starts the shutdown but with the message this will take 10 minutes (!!) Then literallly 10 minutes later, with a countdown message window on the screen-- and the offer to Cancel--  the Mac-mini shuts itself off.
    Why 10 minutes???
    Thanks for your help in advance!

    Hi,
    Thy this :
    1- Cut all code in the "Run AppleScript" action
    2- Copy/paste  this script :
    on run
              tell application "System Events" to shut down
    end run
    -- Otherwise the command "shutdown -h now" requires an admin password and must run in a do shell script

  • HT1776 I have the Energy Saver setting set to NEVER on both options, and my computer STILL goes to SLEEP after 1 hour. Please help!

    I have the Energy Saver setting set to NEVER on both, and my computer STILL goes to SLEEP after 1 hour. Please help!
    My COMPUTER goes to sleep and disrupts my apple tv all the time. How can I fix this?

    That you are getting the BONG is a good sign, it's unlikely to be hardware if you are able to hear that.
    Start by running SW update. It's not that there is a specific fix, but when updating it may rewrite some system files which may get this going again purely as a side affect. Worth a go, and should not harm the system.
    Try reset the PRAM - Resetting your Mac's PRAM and NVRAM
    Hopefully one of these quick fixes works, otherwise we'll need to try isolate the issue next - so if still having a problem, I'd try create a new user and login as that user to see if the issue persists (which will tell us if it's system wide or user specific)

  • Energy saver settings do not stick when set in system preferences

    For some reason when I restore the default settings for the energy saver settings, the settings go back to a custom setting I set months prior of Display Sleep at 1 minute.
    Here is what I am doing:
    Going to "System Preferences"
    Going to "Energy Saver"
    Pressing the button "Restore Defaults"
    Everything goes back to the default settings of Computer Sleep of 10 minutes and Display Sleep of 10 minutes and I close the window out.
    Problem happens: A bit later I come back to my iMac and wake it up, the setting is back to 1 minute of Display Sleep (which I did months ago, I no longer want that).
    I have even locked the setting to prevent further changes. Which locks the settings in place like it should I believe. However, once the iMac sleeps and I wake it up in a couple of hours it switches back to the old setting I made months ago, 1 minute of Display Sleep, which I no longer want.
    Thanks in advance for any assistance!

    i have the opposite problem... i would like to use custom Energy Saver settings but they will not "stick." instead they keep returning to the default settings. i followed the advice on this thread, thinking it might solve my problem too. but it did not. any suggestions?
    i had one hunch - that it might have something to do with the file of same name but with ~orig at the end (see image below). should i remove the other file as well?
    thanks!

  • How to fix energy saver issues on iMac with mavericks upgrade

    Since I updated to Mavericks from lion my energy saver has issues..The display will not turn off as I set it to do.

    Test after each of the following steps that you haven’t already tried:
    Step 1
    Take all the steps suggested in this support article. That's the starting point for any further effort to solve the problem. Skipping any of those steps may mean that the problem won't be solved. Note that, as stated in the article, the computer  will not sleep if Internet Sharing is enabled.
    Step 2
    From the menu bar, select
     ▹ System Preferences ▹ Accessibility ▹ Speakable Items: Off
    Step 3
    Select
     ▹ System Preferences ▹ Bluetooth ▹ Advanced...
    and uncheck both boxes marked
    Open Bluetooth Setup Assistant at startup if...
    Step 4
    Reset the SMC.
    Step 5
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you boot, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.   
    Safe mode is much slower to boot and run than normal. Don’t launch any applications at first. If sleep still doesn’t work properly, back up all data and reinstall the OS. After that, if you still have the issue, make a “Genius” appointment at an Apple Store to have the machine tested.
    If sleep now works as expected, go on to the next step.
    Step 6
    Still in safe mode, launch the usual set of applications that are running when you have the problem, including your login items, one at a time, testing after each one. Some applications may not work; skip them. You might be able to identify the cause of the problem this way.
    Step 7
    If sleep is still working after you’ve launched all the usual applications, reboot as usual (not in safe mode) and test again. If sleep still works, you’re done, at least for the moment.
    If you still have the sleep issue after booting out of safe mode, post again.

  • Computer still sleeps with Energy Saver off

    So in energy saver both of the scrollers are on Never and my computer still sleeps...please help

    It sounds to me some sort of corruption is happening to your Energy Saver preferences. As a temporary fix you may want to try my Spindown Fix program which forces the Unix settings for Energy Saver to no longer go off. It does though have to be run at every Login (startup) to be effective:
    http://www.macmaps.com/software.html

  • Energy saver settings - weird sleep behaviour

    I have customized Energy saver with the following:
    When power Adapter: display sleep 5 min, computer sleep 1hr
    When battery: display sleep 3 minutes, computer sleep 10 minutes.
    This works when I first boot up my Mac. However after the first sleep things get akward, it almost seems to me that MacOSX has swapped these two settings.
    Symptoms: I rebooted my Mac this afternoon. I unplug the power cord. The Mac goes to sleep after 10 minutes.
    I wake the Mac. I leave it still. The screen stays on unusually long. After 20 minutes the Mac is still not asleep as it should be. It usually remains like this until the next complete system reboot.
    This gets annoying when on the go and energy saving really is needed...
    What is happening? Any weird settings file corrupt from previous versions of the system?
    All suggestions welcome...
    JS
    Powerbook G4 12   Mac OS X (10.4.8)   System upgraded from 10.3

    1. You wrote: " the system doesn't shut down at all (an hour after I left the room) when it's supposed to shut down in 4 minutes, as currently set."This is the first you've mentioned about a problem with shutdown, which I would presume to mean a problem with "scheduled shutdown." Previously, you were writing about sleep.
    Are you confusing "idle sleep" with "shutdown" in your post? Let's clarify what you mean by "shut down" in the quote above.
    2. If the problem is idle sleep, then see "Mac OS X: Why your Mac might not sleep or stay in sleep mode." In addition to the causes cited therein, and the corrupted Energy Saver preferences we discussed earlier, some other common inhibitors of idle sleep include:
    • Runaway processes incessantly writing to Console logs will keep the hard drive active and prevent idle sleep. Vendor-provided software included with HP All-In-One devices and Canon scanners are common culprits, but other apps have been known to continuously write to Console logs. See my "Checking Console for clues" FAQ and look for repeating blocks of messages being written at high frequency.
    • Classic Sleep. If you're running Classic apps, be sure that the "Put Classic to sleep when it is inactive for…" slider is set to other than Never in the System Preferences > Classic > Advanced tab.
    3. If the problem is with scheduled shutdown, how that works depends on the version of Mac OS X 10.4 you are using. See:• If 10.4.5 or earlier, see "Mac OS X's Shut Down schedule will only work when one user is logged in."
    • If 10.4.6 or later, see Mac OS X 10.4.6 or later: Scheduled shut down occurs at Login window even if users are logged in."
    Note that your Mac must be awake at the appointed time for scheduled shutdown to work. See "Mac OS X 10.3 and later: Computer must be awake for scheduled shutdown to occur."
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X
    Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Sleep, Energy Saver Troubleshooting

    As one can see below, I have an Acard 6280M and I believe it's generally conceded that they cause sleep and Energy Saver issues. My issue:
    1. Will NOT shutdown automatically at night as scheduled; so, I shutdown manually or it might be asleep all night after I manually sleep it.
    2. WILL awaken from sleep or from shutdown in the mornings, as scheduled.
    (I've made Macaroni inactive; din solve anything.)
    3. Will NOT sleep automatically (set for 'after idle for 25mins'). Monitor will sleep and monitor will awaken with the press of any key on the keyboard. HDD does not sleep.
    Actually, #3 is my main concern; I've lived with 1. and 2. for a while, but 3. is a fairly recent, persistent phenomenon.
    Given that Login items can cause sleep issues, I ran in Safe mode and that did not solve the problems.
    I'm quite ignorant about Activity Monitor. Here's the top few lines from running Top; very similar to what I see in Activity Monitor; with no apps running/active far as I know:
    .........Processes: 53 total, 2 running, 51 sleeping... 141 threads 16:46:30
    Load Avg: 0.07, 0.19, 0.33 CPU usage: 3.5% user, 12.4% sys, 84.1% idle
    SharedLibs: num = 182, resident = 42.1M code, 5.22M data, 8.25M LinkEdit
    MemRegions: num = 5192, resident = 60.0M + 9.61M private, 48.4M shared
    PhysMem: 81.4M wired, 151M active, 529M inactive, 762M used, 261M free
    VM: 5.33G + 136M 29252(0) pageins, 4395(0) pageouts
    PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
    15330 launchd 0.0% 0:00.00 1 10 23 92K 480K 216K 27.7M
    14705 top 11.4% 1:09.57 1 19 22 556K 296K 988K 27.0M
    14704 bash 0.0% 0:00.02 1 14 16 176K 752K 808K 27.2M
    14703 login 0.0% 0:00.02 1 16 36 148K 312K 556K 26.9M
    14701 Terminal 1.2% 0:06.26 4 94 129 1.77M 9.93M 6.89M 216M
    14111 mdimport 0.0% 0:00.54 4 61 49 888K 3.78M 2.72M 40.3M
    11204 DiskManage 0.0% 0:00.77 1 41 42 684K 1.54M 1.82M 37.2M
    11177 System Pro 0.0% 0:02.32 3 93 132 2.23M 8.86M 5.70M 212M
    6746 cupsd 0.0% 0:00.15 2 30 25 460K 736K 1.43M 27.8M
    4006 AppleSpell 0.0% 0:01.60 1 31 35 708K 1.91M 2.02M 37.7M
    3854 lookupd 0.0% 0:10.66 2 34 38 1.12M 752K 1.88M 28.5M
    3405 UniversalA 0.0% 0:42.71 1 65 102 1.15M 4.21M 3.51M 204M
    3404 usbmuxd 0.0% 0:00.01 2 21 22 172K 316K 556K 27.0M
    3403 TechToolPr 0.0% 0:02.43 2 74 102 1.72M 4.80M 4.04M 207M
    Periodically, about every 50-60 seconds, two items pop up for only a second or two:
    'sh' and 'python' (monitoring this stuff is like watching grass grow). Also, at CPU Usage, User will jump to 43% and System to 50%, just for a second or two. Notice at the top, "2 running". Yesterday, it also showed "1 stuck". I ran TTPro 'advanced' and today there's no 'stuck' process. In Activity Monitor, I also quit 'WindowServer' which was persistently showing up. However, the failure to auto-sleep persists. I've had this deal before and a restart usually solved it. I also started from my other drive and downloaded the latest Acard driver. All to no avail. Any ideas will be greatly appreciated!
    Dave

    Hans,
    Okay, in Energy Saver, "...HD sleep is deactivated as I have PCI cards installed..." That isn't right, Hans. DId you install a driver before card installation? One should never lose the ability to at least manually sleep, even with PCI cards. You might want to start a thread of your own.
    I've read through about 10 pages of "sleep" threads here in Discussions (and there must be about 50 pages of em!). Sleep issues are very wide spread, particularly with laptops. I even read one where the user got a new iMac from Apple. Where do I sign up for that?! Again, kinda hoping someone could shed some light on the Activity Monitor and Top activities. MIght not be the problem at all, but they seem odd.
    Message was edited by: David Cun

  • Snow Leopard takes away Energy Saver profiles

    My old iBook with Tiger could switch battery profiles but my new MacBook cannot. Anyone know how to get this feature back?
    John

    It's no longer a part of OS X. There are two profiles that are configured in Energy Saver preferences. One for AC and one for battery. They switch automatically depending upon which power source is in use. There's no longer a need for different performance level selections because the processors change speed automatically. It's a feature built into the CPU called SpeedStep.

  • Energy saver not putting my iMac into sleep mode

    I've tried ejecting my firewire drives and other usb devices but cannot get the iMac to actually turn off per its energy saver settings. Screensaver and then screen shut off both activate per the energy saver settings, but the computer stays on. Only way that sleep mode is ever activated is if I'm in the login screen, or if I manually press the button on the back of the computer.
    Would really appreciate it if anyone has a workaround to actually make my iMac sleep automatically. Never had this problem with my PC..

    This might work for you and save a lot of head scratching. Sometimes these sleep problems just can't be figured out. I've used it successfully. Free
    http://www.dragonone.com/products/macosx/pleasesleep/

Maybe you are looking for