get text from windows clipboard?

Hi,
Is there any way that I can get the text that I’ve copied to clipboard into the game? I’d like to place the copied text from the clipboard in a string variable.

Thanks.

UMG’s TextBox can handle it during run-time, it has an OnTextCommitted event which you use to store your text.

Could you explain a bit.

What I’m wanting is, say I’m working in notepad.exe and I use Ctrl+C, so the text I’ve copied to clipboard while I’m windows explorer. Then I would like to get that text pasted into a variable. Do I just use OnTextCommitted event?

I assumed you need to do it *while *the game is running, is that right? OnTextCommitted should work.
Create a text variable in your widget and have the event set it:

Looks like there is also clipboarCopy and clipboardPaste here:
https://docs.unrealengine.com/en-US/API/Runtime/ApplicationCore/GenericPlatform/FGenericPlatformApplicationMisc/index.html

OnTextCommitted only fires for text typed into that box, it wont see a Ctrl+C you did in notepad. for notepad → game you need to read the OS clipboard directly, which is FPlatformApplicationMisc::ClipboardPaste in C++.

in blueprint the direct version is a paste node returning a string. check Has Clipboard Text first so you dont parse an empty string when the clipboard holds an image or nothing. Runtime Clipboard Utility, a Blueprint clipboard plugin for Unreal Engine 5, has those three nodes (Copy, Paste, Has Clipboard Text), free, UE 5.0-5.8: Runtime Clipboard Utility — Free Copy & Paste Text Nodes for Blueprints (UE5) | Fab