Giving a Mac Intelligence

A few years ago I wrote a Mac application that didn’t do anything, except be stealthy. It ran in the background, without a dock icon or a toolbar icon. I could even change the process name so it looked like a system process to anyone casually looking at their processes. This app could’ve been the basis for some malicious code, but of course that was never my intention.

About a month ago I came up with a new way to use this hidden app. I was doing some work on the command line and I came across the “say” command. It gives you access to the speech center in every Mac. Run the command “say hello” and your Mac suddenly says hello to you just as you told it to. I realized that this has some interesting implications if applied correctly.

An application running in the background could spit out all sorts of entertaining things to the listener. I was originally planning on simply using cron to have the Mac say things at specified times. I then realized I could expand this idea using cocoa and making an app that had many more personality trait– erm… features…

Basically the whole premise of this project is to misuse lots of low level and some high level features that have some legitimate uses.

First I figured out how to get notifications of when the computer is about to go to sleep or when it has just woken up. This uses some low level magic that I just copy and pasted from the Apple reference material. This lets me create the main feature. When you close your laptop, the computer says “Nap time!”, then a few seconds later it says “zzzzzzzzz. I’m sleeping”. When you open your laptop it says “I’m awake!”. It’s a very fun and unexpected feature. It also uses applescript to turn the system volume up to 70% before saying those things so you can be assured they’ll be heard.

The problem is that this doesn’t work on computers newer than mine. I’m running OSX 10.6, but I tried it on two computers running 10.8 and the sleep talking doesn’t work. The system allows you to delay sleep, but it doesn’t let any sounds happen. Presumably Apple realized that when someone closes their laptop, they want it to fully shut up. This is of course problematic for this application, but probably good when my laptop starts making noise in the middle of class.

Regardless, I left this feature in place for those who it works for.

Of course it does need some other personality features as well. I realized that I could setup timers, originating when the user opened the computer. After a certain amount of time, a random amount of time, or at a certain time of day, the computer would do something interesting. In one case, I have it ask if you want to hear a joke. If you press yes, then you get a joke from a list of jokes curated by yours truly. If you press no, then you’re told that you’re boring.

Of course, if I tell you the rest of the features then they won’t be very interesting. So I’ll leave the others as surprises to those who I give this software to. I may post it online at some point as well if I can clean it up and make it work more reliably.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s