PixelSearch is a command, it sets OutputVarX and OutputVarY, it doesn't return a value at all. Because of this, the check against the value
true is invalid.
You could try something like this instead (not tested):
Code: Select all
!u::
Gui Submit, NoHide
Loop
{
PixelSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, 0x15B96E
if (OutputVarX != "" AND OutputVarY != "")
{
MsgBox, 1
SoundBeep, 750, 500
sleep 200
Send, {end}
Click, %OutputVarX%, %OutputVarY%
sleep 1500
}
}
Or just do what looks like was originally the code to begin with, using ErrorLevel.
Check the docs page for the description about how if there is a match found ErrorLevel will be set to 0
Code: Select all
!u::
Gui Submit, NoHide
Loop
{
PixelSearch, OutputVarX, OutputVarY, 0, 0, A_ScreenWidth, A_ScreenHeight, 0x15B96E
If (ErrorLevel = 0)
{
MsgBox, 1
SoundBeep, 750, 500
sleep 200
Send, {end}
Click, %OutputVarX%, %OutputVarY%
sleep 1500
}
}