Autohotkey 在AHK脚本中使用热键

Autohotkey 在AHK脚本中使用热键,autohotkey,Autohotkey,我正试图写一个脚本来帮助我学习一些基本的C语言++ Fire UMETA(DisplayName = "Fire"), 我希望脚本键入文本的后半部分,按home,选择单词,复制,按end,left三次并粘贴 由于某种原因,我无法让它做拷贝粘贴。我试图增加一个延迟,看看这是否有帮助,但没有。我错过什么了吗 #SingleInstance force ^e:: sendinput, UMETA(DisplayName = ""), sendinput, {home} sendin

我正试图写一个脚本来帮助我学习一些基本的C语言++

Fire        UMETA(DisplayName = "Fire"),
我希望脚本键入文本的后半部分,按home,选择单词,复制,按end,left三次并粘贴

由于某种原因,我无法让它做拷贝粘贴。我试图增加一个延迟,看看这是否有帮助,但没有。我错过什么了吗

#SingleInstance force

^e::

sendinput, UMETA(DisplayName = ""),
sendinput, {home}
sendinput, {^w}
sleep, 20
sendinput, {^c}
sleep, 20
sendinput, {end}
sendinput, {left 3}
sendinput, {^v}
sleep, 20
试一试

^e::
    ClipSaved := ClipboardAll      ; save the entire clipboard into the variable ClipSaved
    clipboard := ""                ; empty the clipboard (start off empty to allow ClipWait to detect when the text has arrived)
    SendInput, UMETA(DisplayName = ""),
    Sleep, 30
    SendInput, {home}^+{Right}     ; select the 1st word
    Sleep, 30
    Send, ^c                       ; copy the selected text
    ClipWait, 1                    ; wait max 1 sec for the clipboard to contain data 
    if (!ErrorLevel)               ; If NOT ErrorLevel, ClipWait found data on the clipboard
    {
        clipboard := Trim(clipboard, "`r`n `t") ; trim CRs/LFs, spaces and tabs
        SendInput,{end}{left 3}^v
    }
    Sleep, 300
    clipboard := ClipSaved        ; restore original clipboard
return