按键精灵如何实现每4秒按一次1键每30秒按一次2键。无限循环~

2024-11-08 17:55:08
推荐回答(3个)
回答(1):

Dim tim1,tim2
tim1=now
tim2=now

While true
If DateDiff("s",tim1,now) >= 4 Then
tim1=now
KeyPress "1", 1
Delay 200
End if
If DateDiff("s",tim2,now) >= 30 Then
tim2=now
KeyPress "2", 1
Delay 200
End if
Wend

回答(2):

BeginThread a
BeginThread b
Sub a
Rem q
KeyPress "1", 1
Delay 4000
Goto q
End Sub
Sub b
Rem q
KeyPress "2", 1
Delay 30000
Goto q
End Sub

回答(3):

i = 0
k = 0
While true
i = i + 1
k = k + 1
If i = 4 Then
KeyUp "1", 1
i = 0
End If
If k = 30 Then
KeyUp "2", 1
k = 0
End If
Delay 1000
wend