how to script for wake on lan

Hi,

I am new to the world of Applescript to please bear with me if this seems like a dumb question. I have a mac on my small home LAN whch I store all my music. I put it to sleep when it is not playing music (to an airport express) because of the heat.

I want to write some applescripts to contol it. At the moment I use a small freeware program - WakeUp - to wake up the Mac.

At the start of each script I would like to send a similar wake up call to the Mac. Is this possible in applescript? How?

thanks

martin

I don’t know if you could gui script WakeUp, but fortunately, there is another way.

If you get Wakeonlan, a command line program that sends Magic packets, you could have a “do shell script” line at the beginning of your scripts that would wake up your sleeping computer.

Wakeonlan needs the MAC address of the NIC and, optionally, the broadcast IP address (if you’re using 192.168.1/24 as your network, it would be 192.168.1.255), so the script line would look like this:

do shell script “wakeonlan 01:02:03:04:05:06 192.168.1.255”

Replace the 01:02:03:04:05:06 with the actual MAC address.

Dennis,

Will WakeOnLAN work over the internet? Sometimes, when I’m at work, I’d like to be able to awaken my sleeping Mac at home (across town). So far, I haven’t found a way to do this. (I’m not even sure if it is possible.)

Thanks,
Brad Bumgarner, CTA

The magic packet is broadcast with the network broadcast IP number of the network the computer is on. If your sleeping computer is on a non-routable network (generally 192.168.1/24 is used for home networks) intervening routers won’t be relaying the packets.

Thanks, that’s what I needed to know.

Brad Bumgarner, CTA

Thanks for your help. after a bit of fiddling, getting wakeonlan installed - you need to do it as root, it worked. you don’t need the ip address to wake a mac on the LAN, so my script looks like this:

do shell script “wakeonlan 01:02:03:04:05:06”

Works great for itunes and backups.

Martin