Better Know an Editor Script

I’m new to working with editor scripts, so I’m running some small tests to see what’s possible. Right now I’m having trouble getting Inputs to work:

I want this script to print its string when I press A from inside the editor:

using UnityEngine;
using System.Collections;

[ExecuteInEditMode]

public class PrintAInEditor : MonoBehaviour 
{
	void Update () 
	{
		if(Input.GetKeyDown(KeyCode.A))
		{
			print("You have pressed A.");
		}
	}
}

I have it on my mainCamera in a blank scene, but when I hit A, all I get is the ‘apple alert’ beep as though I’ve hit an invalid key. My first thought was that key inputs are locked from user control in editor scripts, but then again I’ve heard of people writing scripts with their own hotkeys.

what am I doing wrong, or how is this done properly?

Many Thanks!

well I assume you have to make a custom editor for your script and check the input in OnSceneGUI function

Input does not work in the editor. The only option is to create a MenuItem that has an associated hotkey.

An Editor script is a script that inherits from the Editor class, not the MonoBehaviour class.

also u can catch events - Event.current, and check ur input through it, scripting reference says abt it