PDA

View Full Version : Execute script when waking-up


Lutin
08-16-2007, 04:39 PM
Hi,

I'm looking for a way to execute a script when (and only when) login and waking up. My ultimate goal is to be able to run an applescript at login or when waking up that, if you have items in your ~/Public/Drop Box folder, displays a growl-message.

I looked into launchd, login hook (http://docs.info.apple.com/article.html?artnum=301446) and monitoring files such as /var/log/secure.log or /var/log/secure.log

None of those solutions worked for, eg, detecting a waking up from sleep, without a password being asked.

What would you suggest? Yes *you*, don't wait for the next one to reply!

hayne
08-16-2007, 05:14 PM
I recall the existence of a utility (but don't recall its name) that allows you to run scripts upon sleep or wake. I know it's been mentioned before on these forums, so maybe searching for something like: script sleep wake
will find it.

NovaScotian
08-16-2007, 07:19 PM
I use a shareware app called Scenario (http://www.macchampion.com/scenario_features.shtml)

baf
08-17-2007, 02:34 AM
sleepwatcher

Lutin
08-17-2007, 02:59 AM
I found the free SleepWatcher (http://www.bernhard-baehr.de/).
Works fine for getting a script executed when waking up.

For login, I just add the script in the Login Items.

A solution with no installation needed - like a login hook - would have been better when installing onto other computers, but that's great for the moment.

Thank you for your answers.

NovaScotian
08-17-2007, 10:13 AM
SleepWatcher is a unix executable that triggers on sleep or wake, Scenario is a Preference Pane with options to run scripts at Log-in & Out, Sleep (or wake from sleep), and/or when Idle for x minutes. You can assign a Hot Key to run its script(s). Let your level of sophistication decide which is for you. I've used both and opted for Scenario because it's easier to deal with.

Lutin
08-17-2007, 02:21 PM
I'm considering bundling this as an application, and don't want to ask users to install something before to be able to install the product. If anyone knows what is the mechanism used by SleepWatcher, that will save the time to parse the sources.

Thank you