I found Lee Mac's code at this link:
https://www.theswamp.org/index.php?topic=40686.0but I can't execute the block rotation function when pressing the ESC key (when I press ESC it exits the command)
Can someone please help me if possible: Change the block rotation function to the R key