I assume for your first problem you have a window pop up and you're clicking some other button then OK to get rid of the window? If so it would probably be better to
set a timer to run your command every few seconds. For example (I added a little to it):
Code:
SetTimer, EasyTuneClose, 2000 ; runs the EasyTuneClose subroutine every two seconds
EasyTuneClose:
IfWinActive EasyTune5 Build
{
MouseGetPos Px, Py ; retrieves the mouse's current position
Click 280, 14
Click %Px%, %Py%, 0 ; moves the mouse back to its original position without clicking
Sleep, 100
Click 253, 116
Click %Px%, %Py%, 0 ; moves the mouse back to its original position without clicking
Sleep, 100
}
else
return
Optionally, you could examine the EasyTune5 Build window with Window Spy to determine if the things you are clicking are controls. If they are, you can substitute the Clicks for
ControlClicks and avoid using the MouseGetPos and Click %Px%, %Py% statements I added.