如何修复AutoHotkey键快捷方式文件不起作用

时间:2019-09-13 00:13:56

标签: autohotkey

我的 CTRL C CTRL V CTRL T 输入 (由autohotkey制造)不起作用

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^q::
Send, {Ctrl up} c {Ctrl down}
Send, {Ctrl up} t {Ctrl down}
Send, {Ctrl up} v {Ctrl down}
Send, {Enter}

1 个答案:

答案 0 :(得分:1)

Send, {Ctrl up} c {Ctrl down}

没有任何意义。发送Ctrl + c的第一件事是按住Control键,然后再按c并同时松开Control键。 此外,发送的密钥之间必须没有空格,否则脚本将在它们之间发送空格。

尝试一下:

^q::
    clipboard := ""             ; empty the clipboard (start off empty to allow ClipWait to detect when the data has arrived)
    Send, {Ctrl down}c{Ctrl up} ; copy selected text or file(s)
    ClipWait, 2                 ; wait max. 2 seconds for the clipboard to contain data
    If (!ErrorLevel)            ; If NOT ErrorLevel ClipWait found data on the clipboard
    {
        Send, {Ctrl down}t{Ctrl up}
        Sleep, 300              ; wait some time until the Ctrl+t action on the active window is completed
        Send, {Ctrl down}v{Ctrl up} ; paste the selected text or file(s)
        Send, {Enter}          
    }
return  ; terminate the current thread (the hotkey's subroutine)