【发布时间】:2020-11-10 16:09:25
【问题描述】:
自动键功能,text = clipboard.get_selection(),选择的数据存放在哪个剪贴板?
我正在使用 Linux Mint 19.1 Cinnamon 和 Python 3.6。我正在寻找 Autokey (Python 3) 函数text = clipboard.get_selection() 的剪贴板存储。
我假设它存储在 X 剪贴板的三个剪贴板之一中,但没有一个兼容 Gnome 的剪贴板查看器显示它。
我需要知道如何在自动键(或 Python)脚本中引用特定剪贴板,以查看脚本更改前后的数据。
将此代码粘贴到 Autokey3 键盘宏中。 (脚本)并使用任何键定义来激活它。
在 Linux(或任何 X11 应用程序)中,剪贴板所有者进程必须运行才能 # 才能粘贴剪贴板内容?
选择任何文本。
import time
import subprocess
import sys
t_xt = ""
keyboard.send_keys("<ctrl>+a") # select all
time.sleep(.3) # delay of .3 of a second
t_xt = clipboard.get_selection # place selection in clipboard
time.sleep(.3)
keyboard.send_keys(t_xt) # retrieves the t_xt I want to know where this is stored and how I can refer it in an Autokey script?
keyboard.send_keys("<ctrl>+a") # This pastes the contents of a different clipboard.
sys.exit()
【问题讨论】:
-
我不知道为什么帖子的一部分是粗体的。
标签: autokey