Remove script function for manipulating inspector values in IDE (not runtime)

Is there a way to have a script remove itself from an object?

This would be useful for IDE-only operations - for example, zeroing transform coords, instead of having to type it in each time. It's for one-time use before runtime. Usage: drag and drop script into object. script sets object transforms to origin. script removes itself.

There's no reason to do that; just use an editor script (Usage: select object, select Zero Coords from GameObject menu):

@MenuItem ("GameObject/Zero Coords")

static function ZeroCoords () {
    Selection.activeObject.transform.position =;