Re: Detect when I start to work...
Re: Detect when I start to work...
- Subject: Re: Detect when I start to work...
- From: 2551phil <email@hidden>
- Date: Sat, 25 Mar 2017 11:23:57 +0700
On 25 Mar 2017, at 05:52, Jean-Christophe Helary < email@hidden> wrote:
I'll definitely check that when I'm done
Well, if you’re going to go 3rd party you can also achieve what you want very easily with Hammerspoon, which has the added advantage of being free.
Hammerspoon uses the lua language (which is another advantage: you get to learn yet another scripting language). It also doesn’t use Apple Events and bridges directly to the Objective-C (basically the same code as I posted earlier).
Setting up a wake alert is very easy. Check out the hs.caffeinate.watcher: function.
But basically, all you do is put the following code in your Hammerspoon config file.
#handler function myWakeAlert() hs.alert.show("I’m awake!") end #command local wakeWatcher = hs.caffeinate.watcher.new(myWakeAlert):start()
That will display an ‘I’m awake!’ message on wake, but obviously you can put what you like in the function, including calls to AppleScript via the hs.osacript. Check out the full API docs here:
Best
Phil @sqwarq
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden