1

Is there any way to trigger a paste in the windows manager, for example, if I got a text box focused in an application, say, Safari, and I run the command from the command line, it would trigger a paste in the active text box. In short, it would trigger command-v

What I'm hoping to achieve is being able to create scripts, that i can then call from skhd. So, scripts that'd do something ala

pbcopy < stuff.txt
magic-paste-into-focused-component

ish..

bmike
  • 235,889
JustDanyul
  • 207
  • 1
  • 6

1 Answers1

1

Sure, you will have to pbpaste to a temporary file, validate it’s in the clipboard and then trigger the keys for the application of your choosing. There will be many specific details for each part of the chain you will have to get right.

The copy and dumping a file into the clipboard is covered on another question here as is the management of the paste operation.

bmike
  • 235,889