

Show HN: Use your mac as an alarm clock without any special alarm clock apps - vishaldpatel
http://www.seevishal.com/?p=226

======
PCheese
It’s probably nicer to schedule this with iCal instead of crontab. Create a
new iCal event, and add an alert for that event that runs your script. You can
easily and visually configure the event to repeat only on weekdays, and the
best part is that you can simply delete or modify single instances of the
recurring event to deal with exceptions like holidays.

~~~
vishaldpatel
Ah cool - I'll add the iCal version to the post as well, thanks! =).

------
d_r
Shameless plug. I always have trouble waking up. Since the Mac App Store came
out this year, I've been working on a simple alarm clock app called "Mornings"
to do just this (play iTunes or custom MP3s). It actually uses AppleScript to
tell iTunes what to play for the iTunes option, so it works with whatever is
in your playlists. (The "con" to this is that iTunes automatically opens when
the alarm clock plays -- unlike other, more fancy apps, that load the
playlists from iTunes but roll their own playback behavior.) Or you can just
add your own MP3s and the app won't open iTunes.

I haven't posted it on HN before, but I'd be absolutely grateful if anyone
tried it out. As a developer I get some promo codes, so here are some codes
(hit Featured, then Redeem to grab it. Or if none of them work, e-mail me and
I'd be happy to give you one.)

    
    
      F7KTWHLM9H7P 
      3XKY3YEJX9EK
      K63HX7WE9X77
      3RX6ENHL34EE
      WY7X3LRMHKPJ
      JFXETAJH3XYP
      XJXNHTXFEF4P

~~~
Gring
That's a really well designed app! Thanks, I took code #4.

A suggestion: turn up the volume when sounding an alarm. Currently an alarm
might go off, but if the volume is set to 0, nothing will be heard.

~~~
d_r
Thanks! That's a good point, I'm going to have to do that (and perhaps add an
option to fade it in gradually.)

------
biturd
AppleScript does not take into account the system volume level or mute status.
That should be the first line of the script.

~~~
joshzayin
For reference, to set the volume, one would use something like:

    
    
       set volume 10

~~~
vishaldpatel
Thank you both. Will add that to the applescript on the blog post. Cheers.

------
a3_nm
I've been using "sleep 28000; mplayer whatever.ogg" as an alarm clock (without
any special app) for a few months now. Less polished, but it works. :-)

------
pygy_
Back in the days of Mac OS 9 (IIRC), it was possible to schedule the boot time
of Macs, and have a script automatically play the CD present in the drive.

I don't remember the very details because I only used the (second hand) Mac
for a few weeks, and the scheduler wasn't reliable (anymore?). But still, it
was a cool trick.

~~~
joshzayin
You can still set it to boot at a certain time with OS X, and if you set up
auto-login and have that as a login item, it'll accomplish the same task.

~~~
pygy_
This is very cool. I looked for this when I bought my MBP, but I didn't find
the option. A quick google trip and I found that you do it from the _Energy
Saver_ preference pane.

Thanks for the tip.

On a tengential note: Is it possible to turn on the screen backlight
programmatically?

Since OS X 10.6.3, the backlight remains off when waking up from hibernation
(this is documented in [1]). The proposed solution is to delete the related
plist, which resets the hibernate mode to the default settings that are
useless for me. My current solution is to close back the lid for a split
second in order to trigger the hibernation process, then to fiddle with the
arrow keys to abort it. I'd prefer something more elegant.

1\.
[https://discussions.apple.com/thread/2384628?start=90&ts...](https://discussions.apple.com/thread/2384628?start=90&tstart=0)

~~~
joshzayin
I don't have that problem on my MBP with 10.6.8. How are your Energy Saver
preferences set up? Trashing the plist and resetting it to how you like it
might work--it's possible that the plist is corrupted.

~~~
pygy_
I'll try to reset the plist, then, thanks for your help.

    
    
                           Battery         Power Adapter 
    
        Computer sleep:    10 min          45 min
        Display sleep:     2 min           3 min
        Put HD to sleep:   Yes             Yes
        Wake up from LAN:  Yes             Yes
        Dim before sleep:  Yes             Yes
        Boot after power failure:          No

------
xfax
come on, just 'man at' and use vlc and point to a mp3. been doing it since
2001.

~~~
jrockway
This is what I do when I'm too lazy to find my phone and set an alarm. It's
never failed me.

(Actually, I use mplayer, but same idea.)

------
benatkin
This one works well for me, and it's free:
<http://www.robbiehanson.com/alarmclock/>

The last version was released in 2007 but it still works great on Snow
Leopard. I'm in no rush to replace working apps with Mac Store apps.

------
X-Istence
I've got an old laptop running BSD, and for those days that I absolutely need
to be awake at a certain time I tend to schedule, using at, for a cat
/dev/random > /dev/snd. Never fails to wake me up :P

~~~
knotty66
Me too. Lovely sound to wake up to.

sleep 6h && cat /dev/urandom > /dev/dsp

------
hollerith
I would like this solution better if I knew a way to play an audio file from
"the commandline" without having to rely on a big app like iTunes or VLC.

~~~
judofyr

        /usr/bin/afplay

~~~
hollerith
Thanks -- exactly what I wanted.

------
dholowiski
That's cool, but doesn't everyone use their cell phone as their alarm clock?

~~~
vishaldpatel
Haha, yes a lot of people do, I think. I wanted to setup an internet radio
station as my alarm clock and I still use my laptop =).

