Script for assigning hotkeys

Hello,

I want to learn max scripting, and I came up with the idea for a script that would assign a hotkey to any clicked button in 3ds Max. The way it should work is you run your script and then you press some 3ds Max button, then you assign a hotkey. Like you would assign hotkey in Zbrush by first pressing ctrl + alt and clicking on some button than you assign your hotkey.

My question is, is it even possible in 3ds Max?
Is there any way of exposing actions by clicking on them, trough listener or some other way?

Thanks in advance.