AHK-AC批次腳本

2023/09/16閱讀時間約 2 分鐘

^+A::


__ImageFilePath:="C:\Users\jason\Desktop\U2\WINDOW-01.PNG"

gui,add,picture,hwnd__mypic,%__ImageFilePath%

InputBox, UserInput, 訊息, 請輸入要執行的次數:

If ErrorLevel

return

Loop, %UserInput%

{

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;上下分號內包起來的是迴圈

WinActivate, test-230509-01.txt - 記事本

if FileExist(__ImageFilePath){

controlgetpos,,,__img_w,__img_h,,ahk_id %__mypic%

;獲取物件的長寬

CoordMode, Pixel, WINDOW

;搜尋圖片

ImageSearch, __FoundX, __FoundY, VirtualX, VirtualY, VirtualWidth, VirtualHeight,%__ImageFilePath%

if (ErrorLevel=0) {

WinActivate % "Microsoft Excel - STK叫多批-test-01.xlsm"

Sleep, 1000

Send, ^+D

Sleep, 1000

WinActivate, test-230509-01.txt - 記事本

Sleep, 1000

Send, ^v

Sleep, 1000

} else {

Msgbox % "圖片未找到"

}

} else {

Msgbox % "圖片路徑不存在"

}

gui,destroy

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;上下分號內包起來的是迴圈

}


WinActivate % "Microsoft Excel - STK叫多批-test-01.xlsm"

Sleep, 1000

Send, ^+D


return


Great
Great
留言0
查看全部
發表第一個留言支持創作者!