detectstring=function(hwnd,x1,x2,y1,y2){
import string.ocrLite;
import string.ocrLite.defaultModels;
import soImage;
import soImage.directX;
var sodx = soImage.directX();
var so=soImage();
win.setForeground(hwnd);
win.delay(20);
sodx.captureWindowToImage(so,hwnd);
sodx.close()
so.crop(x1,x2,y1,y2)
so.grayScale()
mainForm.picturebox.image=so.getBytes()
var ocr = string.ocrLite(,true,true);
var ocrResult=ocr.detectBuffer(so.getBytes());
so.delete()
if ocrResult {
return ocrResult.text
}else{
return "";
}
}
str=detectstring(hwnd,139,623,310,669)
mainForm.edit.print(str)
发表评论