0

I use an application called NoSleep. Technically it is a Kernel Extension. It is used to prevent a Mac (OSX Mavericks) from going to sleep when you close the lid.

https://code.google.com/p/macosx-nosleep-extension/

NoSleep works fantastically well. I only have one issue. I want the NoSleep feature ON when the computer boots and performs auto login. By default NoSleep is running but in an off state. To toggle on, you simply click (once) the NoSleep icon on the system bar (up where volume, dropbox etc shows up), upper right.

I would like a simple AppleScript that I can run at startup as an App using System Preferences/ Users and Groups / login items. That just clicks that icon.

  • could you look in the console to see who is truing it off ? – Ruskes Jun 12 '14 at 21:45
  • There is an alternative solution, very simple and very stupid. You can use cliclick to actually click on that icon. – Sergei Jun 23 '14 at 19:38
3

Although this is not an ApplesSript (and I would still like to know how to resolve the question via clicking etc) there is another way to skin the cat. The application can be installed with a command line interface. If installed: you can turn NoSleep on as follows:

NoSleepCtrl -a -b -s 1,1

That is easy enough to script that I can even do it.

1

Either click menu bar item 1 of menu bar 2 or click menu bar item 1 of menu bar 1 works with some menu extras:

tell application "System Events"
    click menu bar item 1 of menu bar 2 of process "FastScripts"
end tell

Neither works with NoSleep though.

Status menus are shown by the SystemUIServer process:

tell application "System Events" to tell process "SystemUIServer"
    tell (menu bar item 1 of menu bar 1 whose description is "Clock")
        click
        click menu item -1 of menu 1
    end tell
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .