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

Asked by 谢宝良

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

--- 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:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
谢宝良 (xiebaolianger) said :
#1

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

Revision history for this message
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.

Revision history for this message
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

Revision history for this message
RaiMan (raimund-hocke) said :
#4

... the rest is normal Python scripting.

Revision history for this message
谢宝良 (xiebaolianger) said :
#5

Thanks RaiMan, that solved my question.