Accessing clipboard through software built on Python
Brian Oney
brian.j.oney at googlemail.com
Sun Oct 28 13:46:05 EDT 2018
You don't have to start from scratch. You don't to do anything other than learn to use anamnesis. I use anamnesis as my clipboard manager. I you can easily tell to get which ever one you want (i.e. the thousandth item).
# Inform yourself
https://sourceforge.net/projects/anamnesis/
# Install it
cd ~/bin/src/
wget -O anamnesis.tar.gz https://sourceforge.net/projects/anamnesis/files/latest/download
tar xzf anamnesis.tar.gz
ln -sf ~/bin/src/anamnesis-1.0.4/source/anamnesis.py ~/bin/anamnesis
# Be happy
It hasn't changed in years and that's just fine. I just works. I can access it through the command line when I am in a remote ssh session. Or I have it as a autostarted daemon. It uses sqlite to store all your copied (and selected, if configured) text, which can be slow on a spinning disk. If this turns you off, replace your OS hard drive with an ssd - life's too short.
HTH
On October 28, 2018 5:14:54 PM GMT+01:00, Tim Daneliuk <info at tundraware.com> wrote:
>On 10/27/2018 08:17 AM, Musatov wrote:
>> I am wondering if Python could be used to write a program that
>allows:
>>
>> 1. Highlight some text
>> 2. Ctl+HOTKEY1 stores the string of text somewhere as COPIEDTEXT1
>> 3. Highlight another string of text
>> 4. Ctl+HOTKEY1 stores another string of text somewhere as COPIEDTEXT2
>>
>> THEN
>>
>> 5. Ctl+HOTKEY2 pastes COPIEDTEXT1
>> 6. Ctl+HOTKEY2 pastes COPIEDTEXT2
>>
>> I found "pyperclip" and "Tkinter" but I don't know where to start.
>>
>> Thanks,
>>
>> Musatov
>>
>
>
>I am able to do this with clipboard (pip install clipboard).
>
>
>However, the highlighted text must be copied explicitly:
>
>Highlight
>Ctl-C
>
>In Python:
>
>TEXT1 = clipboard.paste()
>
>Highlight again
>
>TEXT2 = clipboard.paste()
>
>X actually has several clipboard buffers and it can be tricky to get
>this going. I don't recall,
>but either clipboard or pyperclip have a way to get to them all IIRC
>...
>
>HTH,
>-Tim
>
>--
>https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list