协助 ControlSend 将击键循环到后台程序

Assistance with ControlSend to loop a keystroke to a background program

具体来说,我试图让 autohotkey 每两分钟将 F 键盘键发送到一个名为 window 的 window 程序在后台时,这样我就可以做其他事情而不必挂机注销。

目前我一直在尝试

Loop {

SetTimer, PressTheKey, 240000 Return

PressTheKey: ControlSend,,f,Dawn of Fantasy Return } F12::Pause

但我不确定它是否正常工作,或者我是否搞砸了编码。

如果你有SetTimer

,则不需要Loop{大括号}
SetTimer, PressTheKey, 120000
Return

PressTheKey:
    ControlSend,,f,Dawn of Fantasy
Return

F12::Pause

如果它仍然不起作用,请确保您有正确的 window 标题,据说有时这种方法在游戏 (directX) 方面有帮助 (down>sleep>up):

ahk_parent 因为控制是另一个可能有用的调整)

PressTheKey:
    ControlSend,ahk_parent,{f down},Dawn of Fantasy
    Sleep 250
    ControlSend,ahk_parent,{f up},Dawn of Fantasy
Return