stop a macro when pressing the Esc key

I need help for de macro!

Is there any way to stop a macro when pressing the Esc key?

or event (class) that can detect the use of ESC keys?

I looked everywhere and I found no solution, will anyone have any idea how I can do it?

thank.

SolidworksApi/macros