This is the hardest thing for me too.
I drink hot sweet tea rather than sit with my hand in a bag of M&Ms.
I also brush my teeth so that if they are clean, I might think twice about polluting them! In this vein I might also sit and cleanse and tone and moisturize my face, or do a manicure or pedicure. All of these work great at distraction when watching TV, which is the one and only time when I am tempted to eat sweet stuff mindlessly.
I also eat almonds rather than chocolate or cookies. It has the same "hand in bag, hand to mouth, crunchiness" of M&Ms, so that helps mimic the action of eating chocs and they are full of healthy fats and vit E.
I also force myself to sit and peel and eat an orange. Then, If I am still in need of eating something, I may eat some cheese. Again, yeah, it's calories but at least there's some protein and calcium with it!
Thee are the kinds of deals I make with myself.
Then sometimes I realize that the desire to eat cookies is great and I am going to give in to it, in which case I plan for it. I eat the cookies and call it dinner. Not so good nutritionally, but it fits within the "calories in-calories out" theory.
Clare