【发布时间】:2018-06-02 17:21:40
【问题描述】:
由于某种原因,即使在没有白色像素的黑色 PNG 文件上使用添加 GUI 后,下面的 PixelSearch 也无法正常工作。需要它作为循环的一部分工作。
;Pres P on keyboard to test
p::SearchPixels()
Esc::exitapp
SearchPixels(){
;DefinRegion
TLX = 1104
TLY = 373
BRX = 1422
BRY = 452
SomeText := "Found"
Gui,+AlwaysOnTop
Gui, Add, Text, cLime, %SomeText%
Gui, Show, xCenter yCenter
PixelSearch, FoundX, FoundY, TLX, TLY, BRX, BRY, 0xFFFFFF, 3, Fast RGB
if ErrorLevel {
MsgBox Not Found
} else {
MsgBox %SomeText%
}
Gui, Destroy ; Destroy the GUI
Return
}
但是,它在下面没有 GUI 的代码中可以正常工作。有没有办法在不使循环不起作用的情况下添加 GUI?
;Pres P on keyboard to test
p::SearchPixels()
Esc::exitapp
SearchPixels(){
;DefinRegion
TLX = 1104
TLY = 373
BRX = 1422
BRY = 452
SomeText := "Found"
PixelSearch, FoundX, FoundY, TLX, TLY, BRX, BRY, 0xFFFFFF, 3, Fast RGB
if ErrorLevel {
MsgBox Not Found
} else {
MsgBox %SomeText%
}
Return
}
【问题讨论】:
-
很可能是 GUI 挡住了视图?还是背景窗口变暗,因为不再聚焦?
标签: loops user-interface autohotkey break