如何获取剪贴板的文本并保存到文件里 - How to get the clipboard text and save it to a file

Asked by 谢宝良 on 2017-12-16

我想保存剪贴板的内容到文件里,能否实现?

--- question in english (google translate)

I want to save the contents of the clipboard to the file, can it be achieved?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2017-12-17
Last query:
2017-12-17
Last reply:
2017-12-16
谢宝良 (xiebaolianger) said : #1

如果是python,我一般用pyperclip第三方库的函数pyperclip.paste().
不知道sikuli能否做到。

RaiMan (raimund-hocke) said : #2

#1 in english

If it is python, I generally use the pyperclip third-party library function pyperclip.paste ().
I do not know sikuli can do it.

Best RaiMan (raimund-hocke) said : #3

Python stuff can only be used with SikuliX if it is Python language only (no C-based libraries attached), since SikuliX is Java-based and uses Jython.

Clipboard:
SikuliX has a feature:
http://sikulix-2014.readthedocs.io/en/latest/globals.html#App.getClipboard

RaiMan (raimund-hocke) said : #4

... the rest is normal Python scripting.

谢宝良 (xiebaolianger) said : #5

Thanks RaiMan, that solved my question.