0

Is the clipboard easy to manipulate?

5th Sep 2018, 8:51 PM
Martin Tembo
Martin Tembo - avatar
3 odpowiedzi
+ 7
Javascript You can copy to clipboard from text inputs only. If you want to copy any text content you need to be creative. Maybe create hidden text input or textarea element. Change the value of it and use select() on it which highlights the content inside. document.execCommand('copy'); Will copy the content inside the selected text input. There's no good way to read the current clipboard value.
5th Sep 2018, 9:05 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
Python has a library for this, its pretty easy and straight forward: https://pyperclip.readthedocs.io/en/latest/introduction.html #From the docs import pyperclip pyperclip.copy('Hello world!') pyperclip.paste()
5th Sep 2018, 9:24 PM
Steven M
Steven M - avatar