• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Detect when I start to work...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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. 

http://www.hammerspoon.org

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. 
http://www.hammerspoon.org/docs/hs.caffeinate.watcher.html

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:

http://www.hammerspoon.org/docs/hs.osascript.html


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

  • Follow-Ups:
    • Re: Detect when I start to work...
      • From: Jim Underwood <email@hidden>
References: 
 >Re: Detect when I start to work... (From: Jim Underwood <email@hidden>)
 >Re: Detect when I start to work... (From: Jean-Christophe Helary <email@hidden>)

  • Prev by Date: Re: Lists to XML ?
  • Next by Date: Re: Detect when I start to work...
  • Previous by thread: Re: Detect when I start to work...
  • Next by thread: Re: Detect when I start to work...
  • Index(es):
    • Date
    • Thread