I'm playing around with simple gui's with AHK. In one example I found, pressing the escape key will exit the gui, example shown below. I would like to replicate this behavior, but for a right or left click of the mouse. Is there an equivalent, perhaps GuiLButton?
I found that this solution blocks Lbutton and Rbutton. My concern is that this remaps the clicks. I would only want LButton and RButton to be remapped if the GUI is opened.
Yes, the buttons are "trapped" until changed, or until the script exits. If you just want to click on the GUI instead, then see the alternative that I mentioned in the post.
More broadly, one can use an #If directive to provide a required context for a hotkey; explained in the documentation, with examples.
I have never found that the mere existence of a hotkey affects performance. You can always measure it through a CPU monitor, etc. The design of a hotkey routine could affect performance when that routine is being executed.