更新於 2023/07/12閱讀時間約 2 分鐘

AHK-偵測資料夾內圖片

需使用新版本


;========================================

SysGet, VirtualHeight, 79

SysGet, VirtualWidth, 78

SysGet, VirtualX, 76

SysGet, VirtualY, 77



;========================================

^F5::Reload

;========================================



^+j::

ImageFolderPath := "C:\Users\jason\Desktop\U2\"


ImagesExist := ImageFolderSearch(ImageFolderPath)


if (ImagesExist) {

MsgBox, OK

} else {

MsgBox, 找不到圖片

}

return


ImageFolderSearch(folderPath) {

FileList := ""

Loop, Files, %folderPath%*.png

{

FileList .= A_LoopFileFullPath "`n"

}


Loop, Parse, FileList, `n

{

ImagePath := A_LoopField

if (FileExist(ImagePath)) {

if (ImageSearchDLL(ImagePath)) {

return true

}

}

}

return false

}


ImageSearchDLL(imagePath) {

ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, %imagePath%

return (ErrorLevel == "0")

}


分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.