+3 votes

Is there currently a way to copy a string to your PC's clipboard from code?
(equivalent of CTRL+C and having some text stored for later being able to paste somewhere)

I wish to create a button that allows to user to copy to clipboard without having to select the text and copy it themselves.

asked Oct 21, 2016 in Engine by Tybobobo (452 points)

1 Answer

+5 votes
Best answer

Isn't OS.set_clipboard(string) exactly what you want?
Also, string OS.get_clipboard() does the opposite operation :-).

answered Oct 21, 2016 by Bojidar Marinov (1,546 points)
selected Oct 21, 2016 by Tybobobo

Perfect, thank you :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.