Jason Allemann of JK Brickworks (previously documents his latest creation: a poltter that squeezes precise patters of icing onto cookies, built out of Lego Mindstorms, and includes full, downloadable instructions.
I've seen variations on this with hot-glue guns and other extruders, and it's a really cool application. My guess is that you'll have to put some work into cleaning the nozzle, though.
The most important factor to successfully icing a cookie is the consistency of the icing. If it is too runny you will get a blobby mess. If it is too thick you won't get a complete design. It's hard to describe the ideal consistency, but it's probably about the same as you would want if you were icing the cookies by hand. You may have to experiment to find the right balance. Don't expect it to work perfectly the first time you try it.
You will probably get icing everywhere, especially if it is too runny. Be sure to adjust the height of the 'ice stopper' so that it blocks the end of the icing tip when it's not icing. For smooth operation of the squeeze roller it is best to fold the sides of the icing bag in on itself as you drape it over the squeeze plate, before securing it in the back.
EV3 Cookie Icing Machine [Jason Allemann/JK Brickworks]
(via Red Ferret)