Do you see an error message of some sort? Is there any other information you can provide? Downloading the posted code gives me no problems. Esc + D shows a message box, and F2 hits Escape D. (tested by closing the move window in Adobe Illustrator).
No error message, just like sending Esc and the letter d. F2 can't hit Esc d for my case. See below.
If I change the Esc key to ctrl or alt, there is no problem at all.
I am running v2.0.11 on win10 by the way.
Looks like it works just fine in the gif. I suspect the problem is you believe that hitting F2 should also send the message box? You weren't clear on what is supposed to happen. If so, then I have a hard time believing (though I can't test) it worked like that in v1 since both versions use the keyboard hook which would prevent the combo from being triggered by another hotkey without additional code. If you're expecting the message box to show up with F2, I would look into SendLevel and/or InputLevel.
@niCode , thanks for your reply and sorry for the confusion. That is right I am expecting F2 to fire the hotkey Esc+d and send the same message box. Below is what I changed from Esc to ctrl. There is no problem.
Using $, *, or ~ prefixes use the keyboard hook, as do custom combinations like in the original post. The keyboard hook prevents other hotkeys from triggering it. The new code doesn't use the keyboard hook so it can be triggered by other hotkeys. Have a look at the links I posted before on how to get hotkeys that have been "hooked" to be triggered by other hotkeys.