How to enable copy/paste/delete for programatically selected objects?

I’m writing some editor scripts and I’m using Selection.activeGameObject to programmatically select objects in the editor. The problem is, whenever I select an object programmatically the Copy/Paste/Delete/Duplicate commands from the Edit menu are disabled.

Does anyone know how to programmatically select an object and enable the Edit menu commands?

Yes, you can either select the object and execute a menu command:

public static void PerformOperation(string operation)
    EditorApplication.ExecuteMenuItem("Edit/" + operation);

Selection.activeObject = myObj;

Or, you can select the object and send a key down event, see this answer (sends a F2 for rename)