top of page
Search

iMessage When Your Code Sucks

  • Writer: Kiranbir Sodhia
    Kiranbir Sodhia
  • Apr 10, 2013
  • 1 min read

I work on a project that takes up to 2 hours (awesome C++ templates) to clean build. I code my changes, run the build script, and find something to occupy my time. It has generally been coffee breaks and scouring the web for photos of pandas being cute.

Getting back to the point, I unfortunately assumed my build completed after 2 hours. It barfed about a missing semicolon 10 minutes into my panda happiness. I started twiddling around with the idea of sending an iMessage to my phone whenever the build succeeded or failed. Of course, AppleScript was the obvious path to take. It turns out, sending a message was a lot easier than I thought. Here is a simple snippet to send an iMessage to your phone (1-555-867-5309) from your associated iMessage email (come@mebro.com).

on run argv
    tell application "Messages"
        set message to item 1 of argv
        send message to buddy "15558675309" of service "e:come@mebro.com"
    end tell
end run

This above script takes argv[1] and sends it to your device. This can be extended to send a file, for example a text file containing the build failure.

on run argv
    tell application "Messages"
        set message to item 1 of argv as POSIX file
        send message to buddy "15558675309" of service "E:come@mebro.com"
    end tell
end run

These scripts ended up working well for me. However, I eventually realized I don’t like to be interrupted while I watch pandas being cute.

 
 
 

Recent Posts

See All

Comments


bottom of page