我必须使用一个列出我的客户端进程的软件。如果50x10像素区域发生变化,我需要一个声音警报程序。我试着用autohotkey写一个程序,但没能成功。有人有这个程序吗?
这里有一个可以使用的示例。
^Launch_Media:: ; Make a reference screenshot with NirSoft NIRCMD by pressing Ctrl+Media or any other program...
run, "C:Program Files1 My Programsnircmd.exe" savescreenshot "c:TempScreenshot.bmp" 33 40 17 20 ; Location of "Save As" Icon in SciTE4AutoHotKey Editor
Return
Launch_Media:: ; Launch this test manually with Media Button
CoordMode Pixel ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, 200, 200, C:TempScreenshot.bmp ; search for image in area staring at 0,0 to 200,200
if ErrorLevel = 2
MsgBox Could not conduct the search.
else if ErrorLevel = 1
MsgBox Image could not be found on the screen.
else
SoundBeep, 1000, 1000
MsgBox The Image was found at %FoundX% %FoundY%.
ClickX:=FoundX + 5 ; Move the mouse click away from the edge of the icon
ClickY:=FoundY + 5 ; Move the mouse click away from the edge of the icon
Click, %ClickX%, %ClickY% ; Click on the Save As icon.
Return
当我们更多地了解您想要测试的内容(我认为50x10的区域可能太小),以及在区域发生变化时您想要做什么时,我们可能能够帮助您制定更合适的脚本。
在这个例子中,我使用了NirSoft的nircmd.exe,但您也可以通过其他方式创建参考图像。如果您只需要一个声音警报,您可以用注释if, then, else
下的所有其他命令。
你在AutoHotKey社区查看了两年前的这篇文章吗?
http://www.autohotkey.com/board/topic/56219-fast-screen-change-check-using-histograms/
上面的脚本可能有点让人不知所措,但你也可以像之前其他人一样,创建一个固定区域的屏幕截图,并在AutoHotKey中进行图像比较。