Using "Wake for network access" with an applescript service

Discussion in 'Mac Programming' started by pierat, Feb 11, 2011.

  1. pierat macrumors member

    Dec 28, 2010
    Hi all,

    This might be way off base, because I know very little about writing applescript and programming. I am just wondering if this is even possible.

    I use this script written by Andreas Amann that creates an ical event to send emails at a scheduled time.
    Sometimes I need messages to fire off in the middle of the night to catch people in different time zones, and it works flawlessly. The only problem is that I must leave my computer on without going to sleep all the time for the messages to be sent. I know I could set the computer to wake at certain times, but it's a pain in the neck to change that every time I make a scheduled email. Also, if I have more than one in a 24 hour period, I can only set the computer to wake once. So, I came across this setting in the energy save tab that allows incoming network connections to wake the computer from sleep. I'm sure you already see what I'm getting at.... Is there any way to sort of "attach" this service to a bonjour item and get the computer to wake up when the script runs? Maybe a request to share a printer connection could be added to the script to wake up the machine. What I was thinking is that this could run from something like a linux wall wart. I wouldn't know where to start, but I'd like to know if it's possible.
  2. andy 111r macrumors newbie

    andy 111r

    Nov 13, 2010
    Thats a tricky one as Applescript wont run when your mac is asleep.

    There's a pmset terminal command that will wake/sleep the mac but it doesn't support multiple events.

    You could write a script holds your wake up times, sets a new pmset command and is itself activated by launchd after the wake up event to set a new pmset. I'm fairly sure that would work.

    If you are new to Applescript it could be a bit tricky - I'll have a look at it when I get a free mo.

    There's also a daemon you could try called sleepwatcher but I've not used it.

Share This Page