マウス座標から指定サイズの画像をbmpで保存し、保存した画像でchkimgを試せます。撮影用のキーをPrintScreenかPauseから選択可。
ScreenCapture.Run()
module ScreenCapture
dim w = 100, h = 100
hashtbl menu, keyname
dim capflg = FALSE
dim bmpname, key
procedure ScreenCapture
key = VK_SNAPSHOT
sethotkey(key, 0, "Capture")
sethotkey(VK_ESC, 0, "Capture")
menu["size"] = "幅: " + w + " 高さ: " + h
menu["key"] = "キーを変更"
menu["capture"] = "キャプチャする"
menu["find"] = ""
keyname[VK_SNAPSHOT] = "PrintScreen"
keyname[VK_PAUSE] = "Pause"
fend
procedure Run()
while TRUE
select slctbox(SLCT_BTN or SLCT_STR, 0, "簡易画面キャプチャツール", menu)
case menu["size"]
value = input("幅と高さを半角スペース区切りで入力", w + " " + h)
if length(value) then
size = split(value, " ", TRUE, TRUE)
if length(size) = 2 then
w = size[0]
h = size[1]
menu["size"] = "幅: " + w + " 高さ: " + h
else
msgbox("不正な値です")
endif
endif
case menu["capture"]
capflg = TRUE
balloon("取得範囲の左上にマウスカーソルを移動して" + keyname[key] + "を押してください (Escで中断)")
while capflg
sleep(0.1)
wend
balloon()
if length(bmpname) then
menu["find"] = "保存した画像でchkimg"
endif
case menu["key"]
oldkey = key
select slctbox(SLCT_BTN or SLCT_STR, 0, "キーを選択", keyname)
case keyname[VK_PAUSE]
key = VK_PAUSE
case keyname[VK_SNAPSHOT]
key = VK_SNAPSHOT
default
key = oldkey
selend
sethotkey(oldkey)
sethotkey(key, 0, "Capture")
case menu["find"]
if chkimg(bmpname) then
msgbox("G_IMG_X = " + G_IMG_X + "<#CR>G_IMG_Y = " + G_IMG_Y)
else
msgbox("見つかりませんでした")
endif
default
exit
selend
wend
fend
procedure Capture
if capflg then
capflg = FALSE
select HOTKEY_VK
case VK_SNAPSHOT, VK_PAUSE
gettime()
bmpname = G_TIME_YY4 + G_TIME_MM2 + G_TIME_DD2 + G_TIME_HH2 + G_TIME_NN2 + G_TIME_SS2 + ".bmp"
saveimg(bmpname, 0, G_MOUSE_X, G_MOUSE_Y, w, h)
msgbox(bmpname)
default
if msgbox("中断しますか?", BTN_YES or BTN_NO) <> BTN_YES then exit
selend
endif
fend
endmodule