Use the Actions sidebar in the upper right to Move your post to the API sub-forum. That is where the coders hang out. They will be better able to answer your question.
Is this what you are looking for?
1. Run a keyoard shortcut that starts a macro that listens for the swMouseSelectNotify event. This fires whenever the user makes a selection with the mouse.
2. When the user clicks, the X-Y coords are recorded.
3. A block is inserted at these coordinates.