Published on January 28th, 2014 | by Kalen Wessel3
Converting Caffeine into Code
There is no denying that if you’re working as a developer, systems admin, engineer, or in sales you need that omnipotent drug best known as caffeine. It doesn’t matter if you are a americano, espresso, or straight coffee lover – you just need that fix. A group of colleagues I work with religiously make an effort to take some time to step outside of the office and enjoy the warm friendly environment of Caffè Artigiano.
As a person whose job is to automate as many processes as possible it only seemed fit that I streamline the 11 o’clock coffee rendezvous. Since the actual script isn’t all that exciting I wanted to add something that would up the “wow” factor. I just recently picked up a new keyboard for the office and something that’s great about Cherry MX mechanical keyboards is the ability to swap out the kepcaps. The next move was obvious – purchase a function key that had a coffee mug on it. So now anytime I press the ‘coffee’ key an email is sent out to my coworkers letting them know to finish up whatever they are in the middle of and head out.
If this is your first time running a Powershell script you will need to change the policy on running unsigned scripts. Open Powershell with administrative privileges and execute the following command:
By setting the policy to RemoteSigned; Scripts created locally will run, but those downloaded from the Internet will not.
# Hotkey Coffee Invite Script Start-Process Outlook $o = New-Object -com Outlook.Application $mail = $o.CreateItem(0) $mail.subject = "Coffee in 10 @ Artigiano's" $mail.body = "Don't be late." $mail.body = "" $mail.To = "email@example.com; firstname.lastname@example.org" $mail.Send() write-host "Message Sent"
Sometimes even the simplest ideas can be the most practical (and fun). Maybe CoffeeScript v2 will incorporate some more functionality like randomly selecting which coffee each of us will indulge in.
Get-Random -input "Americano","Espresso","Double Shot"
Keep those coffee pots brewing and lines of code flowing! And if you have any suggestions for a coffee script please let me know in the comments.