求个按键精灵-后台分键循环脚本,要求1键每隔10秒按一次,2键每1分钟按一次,以此类推,无限循环。

求指教,1键每10秒按一次,2键每1分钟按一次。后台无限运行。
2024-12-04 19:55:03
推荐回答(3个)
回答1:

  Hwnd = Plugin.Window.GetKeyFocusWnd()
  Rem A
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 50)
  Delay 60000
  Goto A
  _______________________________________________________
  上面那个错了....没有留意...下面那个六十秒漏了多少个1没有按阿...
  改了一下,应该没有错了吧~
  _______________________________________________________
  Hwnd = Plugin.Window.GetKeyFocusWnd()
  Rem A
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Call Plugin.Bkgnd.KeyDown(hwnd, 50)
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Goto A
  _______________________________________________________________
  无聊的时候想到数值大的时候,上面那样太麻烦了,加个算术-
  _______________________________________________________________
  Hwnd = Plugin.Window.GetKeyFocusWnd()
  Delay 10000
  Rem A
  B = 1
  Rem D
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  B = B + 1
  If B = 6 Then
  Goto C
  Else
  Goto D
  End If
  Rem C
  Call Plugin.Bkgnd.KeyDown(hwnd, 50)
  Call Plugin.Bkgnd.KeyDown(hwnd, 49)
  Delay 10000
  Goto A
  ___________________________________________________________
  晕~~~确实...~~~

回答2:

何必呢..简单的算法

Hwnd = Plugin.Window.GetKeyFocusWnd()
While 1
For 6
Delay 10000
Call Plugin.Bkgnd.KeyPress(hwnd, 49)
Next
Call Plugin.Bkgnd.KeyPress(hwnd, 50)
Wend

回答3:

2楼正解,只不过需要把60000改成50000 要不就变成70秒按一次2键了