Change variable after key clicked

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Mawnas
Posts: 7
Joined: 22 Jul 2017, 14:45

Change variable after key clicked

28 Jul 2017, 08:07

After I click T key, I want to change ColorLocationX variable to be enlarged by 10. It should happen every time, when I'm pressing T.

Code: Select all

t::
CoordMode, Pixel, Window
PixelSearch, ColorLocationX, ColorLocationY, 785, 555, 855, 575, 0x604331, 0, Fast RGB
If (ErrorLevel = 0)
{
    %ColorLocationY% := %ColorLocationY% + 10
    MouseClick, Left, %ColorLocationX%, %ColorLocationY%, 1, , ,
}
Else
{
    MsgBox, 64, AutoTribe, Error! #1 - Nie znaleziono pasujacego piksela, 3
}

Sleep, 250

CoordMode, Pixel, Window
ImageSearch, ZaprosLocationX, ZaprosLocationY, 0, 0, 1366, 768, %A_Desktop%\AutoTribe\Zapros.png
If (ErrorLevel = 0)
{
    MouseClick, Left, %ZaprosLocationX%, %ZaprosLocationY%, 1, , ,
}
Else
{
    MsgBox, 64, AutoTribe, Error! #2 - Nie znaleziono przycisku Zapros, 3
}
Return
So this is how should it look:
1) I press T key
2) Script finds pixel and image
3) When I again press T key, the X coordinate of pixel should be enlarged by 10
4) It should happen every time, when I press T key

I tried this script above, but it returns error, that dynamic variable declared by me is blank.

What am I doing wrong?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, OrangeCat and 166 guests