【问题标题】:Sending the key combination within its remap not working AHK在其重映射中发送组合键不起作用 AHK
【发布时间】:2021-04-12 13:30:10
【问题描述】:

我制作了一个 AHK 脚本,它在 AHK 中编译我的键盘布局,将其移动到 Windows 10 启动文件夹,然后运行它。当我运行脚本并按下它确实运行的组合键时,除了最初发送的 Ctrl + F7 之外,所有功能都正常运行,它应该在我的编辑器中编译脚本。我已经尝试了一些东西,但到目前为止还没有奏效。感谢您的帮助,我附上了下面的代码。

#IfWinActive, ahk_class SciTEWindow ;if script editor is open
    $<^F7:: ;if ctrl+F7 is pressed
    Sleep, 200 ;wait a 0.2 seconds
    Send {^F7} ;send ctrl+F7 to compile script (this line isn't working)
    Sleep, 2000 ;wait 2 seconds for the script to compile
    FileCopy, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe, C:\Users\jackn\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, 1 ;Copies the file to the startup folder
    Sleep, 100;waits 0.1 seconds
    run, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe ;runs the program
    return
return

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    代替

    Send {^F7}
    

    使用

    Send ^{F7}
    

    完整脚本:

    #IfWinActive, ahk_class SciTEWindow ;if script editor is open
        $<^F7:: ;if ctrl+F7 is pressed
        Sleep, 200 ;wait a 0.2 seconds
        Send ^{F7} ;send ctrl+F7 to compile script (this line has been changed)
        Sleep, 2000 ;wait 2 seconds for the script to compile
        FileCopy, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe, C:\Users\jackn\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, 1 ;Copies the file to the startup folder
        Sleep, 100;waits 0.1 seconds
        run, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe ;runs the program
        return
    return
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-27
      • 1970-01-01
      • 2015-12-27
      • 2011-12-13
      • 2022-12-13
      • 1970-01-01
      • 2017-05-23
      • 2011-12-26
      相关资源
      最近更新 更多