public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { Log( "Execute begin" ); UIApplication uiapp = commandData.Application; uiapp.Idling += new EventHandler<IdlingEventArgs>( OnIdling ); Log( "Execute end" ); return Result.Succeeded; }