如何将剪贴板的整个历史复制到文本文件?

pan*_*zia 11 text clipboard

我想粘贴我的整个剪贴板历史记录,其中包含在阅读期间复制的单词(Ctrl+C/按选择)。我安装了 Glippy 和 ClipIt 之类的程序,但我不知道如何粘贴所有单词,如果这些程序中存在这样的选项,我会立即复制到一个简单的文本文件中,一次不是一个单词。有人可以帮我吗?

谢谢!

小智 6

您可以使用以下命令在剪辑历史文件中看到一些字符串:

strings ~/.local/share/clipit/history
Run Code Online (Sandbox Code Playgroud)

但这不是最好的方法。输出可能是乱码。


小智 5

ClipIt 有 python 脚本,像这样运行它 python cliphist.py > clipit.history.txt

#!/usr/bin/env python
"""cliphist.py: utility to print clipit history file.
If an argument is passed on the command line, it will
be used as a separator, otherwise history items are
separated by a blank line. """

import struct, os, sys

homedir  = os.environ['HOME']
histfile = homedir + '/.local/share/clipit/history'
if len(sys.argv) > 1:
    sep = sys.argv[1]
else:
    sep = '---------------------------------------------------------------------'


with open(histfile,'rb') as f:
    f.read(68)
    size,_ = struct.unpack('2i',f.read(8))
    while (size > 0):
        item = f.read(size)
        print item
        _,_,_,size,_ = struct.unpack('5i',f.read(20))
        if size > 0: 
            print sep
Run Code Online (Sandbox Code Playgroud)


Aqu*_*wer 0

用户Parcellite,左键单击其图标,“清除”,选择您想要的次数,然后“编辑剪贴板”并全部复制!请记住如此设置首选项:使用主要选择,以便更轻松地复制文本!