Basicly the answer is in the title >…<
If you’re talking about making an editor script run without having to press Play, then you want to take a look at the following:
http://unity3d.com/support/documentation/ScriptReference/ExecuteInEditMode.html
Yes, pretty much the entire editor / inspector system is written in scripts like this. See here http://unity3d.com/support/documentation/Components/gui-ExtendingEditor.html for some examples.