修改副本&粘贴脚本以将文本插入文本输入

时间:2017-10-05 03:52:41

标签: autohotkey

我已采用https://autohotkey.com/board/topic/72189-simple-clipboard-history/中的以下脚本来保留副本&粘贴历史。

如何以将当前工具提示文本插入文本输入的方式修改脚本?例如,当我打印F8时,AutoHotKey将插入当前工具提示中的文本。

这是脚本:

; Retrieves saved clipboard information since when this script last ran
Loop C:\tmp\clipvar*.txt
{
  clipindex += 1
  FileRead clipvar%A_Index%, %A_LoopFileFullPath%
  FileDelete %A_LoopFileFullPath%
}
maxindex := clipindex
OnExit ExitSub

; Clears the history by resetting the indices
^+NumpadClear::
^+Numpad5::
tooltip clipboard history cleared
SetTimer, ReSetToolTip, 1000
maxindex = 0
clipindex = 0
Return

; Scroll up and down through clipboard history
^Up::
if clipindex > 1
{
  clipindex -= 1
}
thisclip := clipvar%clipindex%
clipboard := thisclip
tooltip %clipindex% - %clipboard%
SetTimer, ReSetToolTip, 1000
Return


^Down::
if clipindex < %maxindex%
{
  clipindex += 1
}
thisclip := clipvar%clipindex%
clipboard := thisclip
tooltip %clipindex% - %clipboard%
SetTimer, ReSetToolTip, 1000
Return

; Add clipboard contents to the stack when you copy or paste using the keyboard
~^x::
~^c::
Sleep 500
clipindex += 1
clipvar%clipindex% := clipboard
thisclip := clipvar%clipindex%
tooltip %clipindex% - %thisclip%
SetTimer, ReSetToolTip, 1000
if clipindex > %maxindex%
{
  maxindex := clipindex
}
Return

; Clear the ToolTip
ReSetToolTip:
    ToolTip
    SetTimer, ReSetToolTip, Off
return

; Saves the current clipboard history to hard disk
ExitSub:
SetFormat, float, 06.0
Loop %maxindex%
{
  zindex := SubStr("0000000000" . A_Index, -9)
  thisclip := clipvar%A_Index%
  FileAppend %thisclip%, C:\tmp\clipvar%zindex%.txt
}
ExitApp

1 个答案:

答案 0 :(得分:0)

^Right: 
    thisclip := clipvar%clipindex%
    clipboard := thisclip
    Send, %clipboard%
Return