Make ESCAPE (ESC) key close window.

How do I make an application that I can make the ESC key close a window? Or really any key (I can change if I want to).

Please help. Thanks

Here is what I have and I can’t get it to work.

-- close window with "ESC"

tell application "System Events"
	tell application "Finder" to activate
	key code 53
	
end tell

beep 3

Thanks! B-

I want to change the command from, Command > W, to, esc to close a window in general.

Thanks! And just incase the ESC key, key code is: 53.

Benjamin

Hi,

AppleScript cannot track keystrokes.
There are some third party tools like QuickSilver or QuicKeys which can map keys

ControllerMate can remap keys too.

Basically you tell ControllerMate “when I see the ESC key, instead output command-W”