1. The script identifies mouse coordinates and whenever something is clicked there, the script activates, but different buttons can appear there and I wish for the script only to run when a specific button is executed. Is there a way I can set up the trigger (not sure what the autohotkey terminology is) to be when the particular button is activated?
2. Only my code is executed, and not the result from clicking the button. I would like the original button to execute as well. I tried adding the line Controlclick and the name of the button using Window Spy under ClassNN, but it only variably works, and I am not sure it is the best approach.
Thanks for any help.
Code: Select all
#SingleInstance Force
#Persistent
#IfWinActive, ahk_class CalcFrame
~LButton::
MouseGetPos, MouseX, MouseY
ControlGetPos, ButtonX, ButtonY, ButtonW, ButtonH, button1, ahk_class CalcFrame
ButtonX2:=ButtonX + ButtonW
ButtonY2:=ButtonY + ButtonH
if MouseX between %ButtonX% and %ButtonX2%
{
if MouseY between %ButtonY% and %ButtonY2%
{
Send !u
Controlclick, classNN_button_name
}
}
Return
#IfWinActive