经常会遇到需要截取固定区域图像的情况,例如云顶之奕英雄名字那块的识别,所以写了下面的demo
#Include Gdip.ahk ^1:: ^2:: ^3:: ^4:: ^5:: ;MsgBox,% A_ThisHotkey 970 1070 ;判断按键 800|1040|170|30 switch A_ThisHotkey { case "^1": screen=800|1040|120|30 case "^2": screen=1000|1040|120|30 case "^3": screen=1200|1040|120|30 case "^4": screen=1400|1040|120|30 case "^5": screen=1600|1040|120|30 } InputBox,heroName,input heroName picturePath:=A_ScriptDir "\config\picture\" Screenshot(picturePath heroName ".png",screen) return Screenshot(OutFile,screen) { pToken := Gdip_Startup() ;screen=0|0|%A_ScreenWidth%|%A_ScreenHeight% pBitmap := Gdip_BitmapFromScreen(screen) Gdip_SaveBitmapToFile(pBitmap, OutFile, 100) Gdip_DisposeImage(pBitmap) Gdip_Shutdown(pToken) }
#Include Gdip.ahk 你这用了另一个脚本 那么这个脚本呢?