【问题标题】:Autohotkey script to do some functions on other window while holding a button按住按钮时在其他窗口上执行某些功能的 Autohotkey 脚本
【发布时间】:2021-04-07 19:00:12
【问题描述】:

我想为我的字典应用程序编写一个脚本,这样当我按住键 j 短时间时,它会激活现有的 KMPlayer 窗口并发送空间并最大化它(通过发送中间鼠标按钮),如果 KMPlayer 不存在,它会发送 Alt+Esc

这是我的脚本:

#IfWinActive Oxford Advanced Learner's Dictionary
~$j::
KeyWait,j,T0.2
 If (ErrorLevel) 
 {
  If WinExist ("KMPlayer 64X")
  {
   WinActivate
   sleep,50
   SendInput,{space}
   sleep,50
   sendinput,{MButton}
  }
 else
 {
 SendInput,!{Esc} 
 }
}
return

但不幸的是,当我按住字典搜索栏中的按钮时,它只会输入类似的内容

j jjjjjj j jjj j jjjjjj j jj

而不是做功能。我不知道如何修复脚本。

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    我通过在 autohotkey.com (this post) 上询问找到了答案。

    这是用户@mikeyww 解决我的问题的脚本:

    #IfWinActive Oxford Advanced Learner
    $j::
    KeyWait, j, T.2
    If !ErrorLevel
    { Send j
      Return
    }
    If WinExist("ahk_exe KMPlayer64.exe")
    { WinActivate
      Send {Space}{Enter}
    } Else Send !{Esc}
    KeyWait, j
    Return
    #IfWinActive
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-01
      • 2019-03-17
      • 2013-06-07
      • 1970-01-01
      • 1970-01-01
      • 2014-04-29
      • 2018-08-21
      相关资源
      最近更新 更多