문제

I need to paste a string of text to whichever application is open, and I'd rather not clear the pasteboard, in case something important is there, and I'd rather not turn every single character into a keyboard event.

Is there another way?

도움이 되었습니까?

해결책

You could try using accessibility: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Accessibility/cocoaAXIntro/cocoaAXintro.html though it may be overkill.

Another option may be to copy the current contents of the pasteboard to a local variable, replace it with your own string, perform your paste, then restore the original value back to the pasteboard. Depends on what you're trying to do.

다른 팁

You could provide a service to paste the provided text.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top