Well I looked into this topic (i.e., right clicking an XYplorer menu item) off and on for awhile and it turns out the solution was right under my mouse. The above AHK code, loaded when the computer starts up along with my existing AHK start-up code (or loaded separately), only needed a automated 'click" of the mouse to function properly with XYplorer. So what is happening is the code above detects when a right click is accomplished on an XYplorer on an XYplorer menu/ctx menu. If it is true (i.e., XY is active and the user right mouse clicks on a context menu), then a XY permanent variable is created. So at this point, the AHK script then sends a normal left mouse click on the XYmenu item. In the XYplorer script, we differentiate between the normal left click of the menu and the right click by the fact that the permanent variable is set. The AHK script is not involved when the user performs a normal left click of the mouse (i.e., the above action is taken for the right click only).
I posted a simple sample script in the forum script section along with an updated AHK script where users can see how to easy it is to code some XYplorer menu scripts which utilize both the left and right mouse buttons. See
viewtopic.php?f=7&t=18062 One most obvious example is being able to execute the normal action of an XYplorer built-in toolbar button with the left mouse button and the button's context menu with the right mouse button. You can also do the same with your Customized Toolbar Buttons. You could assign totally different actions to the left & right mouse buttons. Most importantly, I notice no lag once-so-ever, the right click mouse actions execute as fast as the left.