AHK-STK批次腳本

2023/06/03閱讀時間約 9 分鐘
;==========================================================
SysGet, VirtualHeight, 79
SysGet, VirtualWidth, 78
SysGet, VirtualX, 76
SysGet, VirtualY, 77
;==========================================================
^F5::Reload
;==========================================================
;==========================================================
^+A::
global VirtualHeight,VirtualWidth
gui,add,picture,hwnd__mypic,%__ImageFilePath1%,%__ImageFilePath2%
InputBox, UserInput, 訊息, 請輸入要執行的次數:
If ErrorLevel
return
Loop, %UserInput%
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;上下分號內包起來的是迴
WinActivate % "Microsoft Excel - STK叫多批-test-01.xlsm"
Sleep % 500
Send, ^+D
Sleep % 500
重複01()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;上下分號內包起來的是迴圈
}
WinActivate % "Microsoft Excel - STK叫多批-test-01.xlsm"
Sleep, 1000
Send, {right}
Sleep, 200
Send, END
return
;==========================================================
重複01(){
WinActivate % "test-230509-01.txt - 記事本"
;CoordMode, Mouse , WINDOW
ClickPosition(400, 300, 1, 0, "WINDOW", false)
;__ClickX:=400
;__ClickY:=300
;__ClickTimes:=1
;Click %__ClickX%, %__ClickY%, %__ClickTimes%
Sleep % 200
Send, {RButton}
Sleep % 2000
Send, p
Sleep % 200
Send, {Enter}
Sleep % 200
Send, {Enter}
Sleep % 200
;Send, {F1}
Send, F1
Sleep % 200
Send, m
Sleep % 200
Send, {Enter}
Sleep % 200
SendInput % "{TEXT}" . "RLS"
Sleep % 200
Send, {Enter}
Sleep % 200
Return
}
;==========================================================
^+B::
global VirtualHeight,VirtualWidth
gui,add,picture,hwnd__mypic,%__ImageFilePath1%,%__ImageFilePath2%
InputBox, UserInput, 訊息, 請輸入要執行的次數:
If ErrorLevel
return
Loop, %UserInput%
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;上下分號內包起來的是迴
WinActivate % "Microsoft Excel - STK叫多批-test-01.xlsm"
偵圖01()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;上下分號內包起來的是迴圈
}
WinActivate % "Microsoft Excel - STK叫多批-test-01.xlsm"
Sleep, 1000
Send, {right}
Sleep, 200
Send, END
return
;==========================================================
偵圖01(){
global VirtualHeight,VirtualWidth
gui,add,picture,hwnd__mypic,%__ImageFilePath1%,%__ImageFilePath2%
__ImageFilePath1:="C:\Users\jason\Desktop\U2\WINDOW-01.PNG"
if FileExist(__ImageFilePath1){
controlgetpos,,,__img_w,__img_h,,ahk_id %__mypic%
CoordMode Pixel
;搜尋圖片
ImageSearch, __FoundX, __FoundY, VirtualX, VirtualY, VirtualWidth, VirtualHeight,%__ImageFilePath1%
CoordMode Mouse
;獲取圖片中心座標
圖片座標X:=__FoundX + __img_w/2
圖片座標Y:=__FoundY + __img_h/2
if (ErrorLevel=0) {
;Msgbox % "圖片座標為: " . 圖片座標X . ", " . 圖片座標Y
CoordMode, Mouse , Screen
__ClickX:=圖片座標X
__ClickY:=圖片座標Y
__ClickTimes:=1
Click %__ClickX%, %__ClickY%, %__ClickTimes%
; Send, {RButton}
;_____________________________________________________
偵圖02()
;_____________________________________________________
} else {
Msgbox % "圖片未找到"
}
} else {
Msgbox % "圖片路徑不存在"
}
gui,destroy
}
;==========================================================
偵圖02(){
__ImageFilePath2:="C:\Users\jason\Desktop\U2\WINDOW-02.PNG"
if FileExist(__ImageFilePath2){
;controlgetpos,,,__img_w,__img_h,,ahk_id %__mypic%
CoordMode, Pixel, WINDOW
;搜尋圖片
ImageSearch, __FoundX, __FoundY, VirtualX, VirtualY, VirtualWidth, VirtualHeight,%__ImageFilePath2%
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
}
;==========================================================
^+C::
CoordMode, Mouse, Screen
MouseGetPos, posX, posY
;MousePos := "X: " . posX . ", Y: " . posY
MousePos := "" . posX . "," . posY
Clipboard := MousePos
Msgbox,(%posX%`,%posY%)
return
;==========================================================
Great
Great
留言0
查看全部
發表第一個留言支持創作者!
從 Google News 追蹤更多 vocus 的最新精選內容