1 (изменено: baklan18, 2021-12-20 16:47:41)

Тема: AHK: PixelGetColor

Привет, подскажите как мне использовать функцию if с PixelGetColor.
Вот мой примерный код.


; <COMPILER: v1.1.33.10>
#NoEnv



txtNotFrozen := "(Hold Ctrl or Shift to suspend updates)"
txtFrozen := "(Updates suspended)"




SendMode Input
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
CoordMode, Pixel, Screen
DetectHiddenWindows, On
SetTitleMatchMode, 2
Gui,1:+AlwaysOnTop

Gui, New, hwndhGui AlwaysOnTop Resize MinSize

Gui, Color, ffff66, 00ffff
Gui, Font, bold,
Gui, Font, ffff66

Gui, Add, Edit, x12 y30 w120 h20 vPressAD gTime_all,
Gui, Add, Edit, x12 y60 w120 h20 vClick1 gTime_all,
Gui, Add, Edit, x12 y90 w120 h20 vbind1 gTime_all,
Gui, Add, Edit, x12 y120 w120 h20 vbind2 gTime_all,
Gui, Add, Edit, x12 y150 w120 h20 vbind3 gTime_all,
Gui, Add, Text, x12 y250 w170 h25 , Press F7 to start
Gui, Add, Text, x12 y265 w170 h25 , Press F10 to pause/resume
Gui, Add, Text, x12 y280 w170 h25 , Press F12 to close
Gui, Add, Edit, x12 y310 w120 h20 vPid gTime_all,
Gui, Add, Text, x142 y313 w100 h25 , Write your PID
Gui, Add, Text, x250 y300 w300 h25 r4 ReadOnly -Wrap vCtrl_Title
Gui, Show, w485 h350, script1


return
GuiClose:
ExitApp

Time_all:
Gui, Submit, NoHide
F7::

game := "ahk_pid " Pid

MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
if (TRX = 0x2B2B2B)
	Loop
	{
	SetKeyDelay, 50, 50
	ControlSend,, {/}, %game%
	sleep 100
	ControlSend,, {Enter}, %game%
	sleep 100
	} 
 



Loop
{
SetKeyDelay, 50, 50
ControlSend,, {%Click1% down}, %game%
sleep 100
ControlSend,, {%Click1% up}, %game%
sleep 100
}
F10::Pause
Suspend
Return
F12::ExitApp