papple23g

190930 AHK 多張圖片搜尋

Sep 30th, 2019 (edited)
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;無限循環執行
  2. while true{
  3.     if GetPicturePosition("...\01.png") or GetPicturePosition("...\02.png") or GetPicturePosition("...\03.png"){
  4.         Send {F1}
  5.     } else if GetPicturePosition("...\04.png") or GetPicturePosition("...\05.png") or GetPicturePosition("...\06.png"){
  6.         Send {F2}
  7.     }
  8. }
  9. return
  10.  
  11. ;獲取圖片位置的函式
  12. GetPicturePosition(ImageFilePath){
  13.     gui,add,picture,hwndmypic,%ImageFilePath%
  14.     controlgetpos,,,width,height,,ahk_id %mypic%
  15.     CoordMode Pixel
  16.     ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight,%ImageFilePath%
  17.     CoordMode Mouse
  18.     if %FoundX%{
  19.         return [FoundX+width/2,FoundY+height/2]
  20.     } else {
  21.         return FoundX
  22.     }
  23. }
Add Comment
Please, Sign In to add comment