按键精灵怎么让窗口化的游戏后台循环操作?

按键精灵怎么让窗口化的游戏后台循环操作。3秒F2,5秒F3F4、 6分钟F9。顺便附上截图谢谢哈

s1 = Plugin.Sys.GetTime()
s2 = s1
s3 = s1
Do
If int((Plugin.Sys.GetTime()- s1)*0.001) >= 3 Then '判断间隔3秒
s1 = Plugin.Sys.GetTime()
'KeyPress 113, 1 'f2
TracePrint "f2"
End If
If int((Plugin.Sys.GetTime()- s2)*0.001) >= 5 Then '判断间隔5秒
s2 = Plugin.Sys.GetTime()
'KeyPress 114, 1'f3
'Delay 100
'KeyPress 113, 1 'f4
TracePrint "f3"
TracePrint "f4"
End If
If int((Plugin.Sys.GetTime()- s3)*0.001) >= 360 Then '判断间隔6分钟
s3 = Plugin.Sys.GetTime()
'KeyPress 120, 1'f9
TracePrint "f9"
End If
Delay 1000
Loop
后台自己看着改进去吧追问

大佬,要不发份模板给我吧,不会搞啊...

追答

这个不就是?

温馨提示:答案为网友推荐,仅供参考
第1个回答  2020-03-20
//复制过去就能用。
//方法一:
Hwnd = Plugin.Window.Foreground()
BeginThread a()
BeginThread b()
BeginThread c()
Sub a()
do
Call Plugin.Bkgnd.KeyPress(Hwnd, 113)
TracePrint (now)
TracePrint "F2"
Delay 3000
loop
End Sub
Sub b()
do
Call Plugin.Bkgnd.KeyPress(Hwnd, 114)
Call Plugin.Bkgnd.KeyPress(Hwnd, 115)
TracePrint (now)
TracePrint "F3"
TracePrint "F4"
Delay 5000
loop
End Sub
Sub c()
do
Call Plugin.Bkgnd.KeyPress(Hwnd, 120)
Delay 360000
loop
End Sub

//方法二:
Hwnd = Plugin.Window.Foreground()
s1 = Plugin.GetSysInfo.GetDateTime()
Delay 1000
do
s2 = Plugin.GetSysInfo.GetDateTime()
s3 = datediff("s", s1, s2)
a1 = s3 mod 3
a2 = s3 mod 5
a3 = s3 mod 360
If a1 = 0 Then
Call Plugin.Bkgnd.KeyPress(Hwnd, 113)
TracePrint "f2"
End If
If a2 = 0 Then
Call Plugin.Bkgnd.KeyPress(Hwnd, 114)
Call Plugin.Bkgnd.KeyPress(Hwnd, 115)
End if
If a3 = 0 Then
Call Plugin.Bkgnd.KeyPress(Hwnd, 120)
End If
Delay 1000
loop
相似回答