我正在尝试制作一个 AHK 脚本来将 Enter 键发送到 Red Dead Redemption 2。 {Enter] 键根本不会在游戏内部发送。
看来不止我一个,但是我摸索了半天也没什么收获 https://www.reddit.com/r/AutoHotkey/comments/6goby1/how_to_send_enter_key/ https://www.autohotkey.com/boards/viewtopic.php?t=25880 https://www.autohotkey.com/board/topic/109564-pressing-enter-physically-is-not-the-same-as-send-enter-why/
到目前为止,这是我尝试过的(我省略了Sleep,每个命令之间的 300):
NumpadIns::
Send {NumLock}
; -------------------- Send
Send {Enter}
; -------------------- SendEvent
SendEvent {Enter}
; -------------------- SendInput
SendInput {Enter}
; -------------------- SendPlay
SendPlay {Enter}
; -------------------- SendInput `n
Sendinput {`n}
Sendinput {`r}
Sendinput {`r`n}
Sendinput {\n}
Sendinput {\l\n}
; -------------------- ControlSend
ControlSend ,{Enter}, A
ControlSend, Edit1, {Enter}, RDR2.exe
ControlSend, Edit1, {Enter}, Red Dead Redemption 2
; ----------------- Random stuff
Run, powershell.exe -noexit -file "D:\enter.ps1"
sendMode, Input
#InputLevel 1
SendEvent, {enter}
sendlevel, 1
sendEvent, {enter}
#InstallKeybdHook
#UseHook
Send {$Enter}
ExitApp
return
Powershell 脚本输出(确认最后 3 个命令有效):
True
PS C:\Users\lucas\Desktop>
PS C:\Users\lucas\Desktop>
Powershell 脚本本身:
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Red Dead Redemption 2')
Sleep 1
$wshell.SendKeys('~')
他们都在任何地方工作,除了在游戏中。 显然,我也尝试以管理员身份运行它,它适用于任何其他应用程序(例如 Notepad++)等。 AutoIt 产生相同的结果:除了方向箭头和 {Enter}
之外,一切正常我还在模组论坛上发了一个帖子: https://forums.nexusmods.com/index.php?/topic/8762513-rampage-trainer/page-346#entry123370128
以及展示它的视频,以便您更好地理解。我被困在定位我的 NPC 上 https://www.youtube.com/watch?v=Sp_Hs-ErCOE
任何想法或替代解决方案?