I am creating an app that will reside on the menubar?
I have a text on the clipboard.
I would like to be able to open an app like Safari, have the cursor inside a text field and select PASTE from my app and paste the text that is already on the clipboard to where the cursor is in the active app.
How do I do that?
If that was a normal paste operation inside the same app I would use something like
func pasteboardImage() -> String? {
let pb = NSPasteboard.general
let type = NSPasteboard.PasteboardType.string
guard let string = pb.string(forType: NSPasteboard.PasteboardType(rawValue: "com.apple.flat")) else { return nil }
return string
}
How do do I do that, to paste into the selected field of the active app?
NOTE: the suggestion answer does not work for me because I don't want to simulate a CMD V, that would paste the clipboard. I want to use my app to send text to another app.