how to generate a paste command without eventap.keyStroke?

22 views
Skip to first unread message

dmg

unread,
Aug 5, 2024, 12:45:01 AM8/5/24
to Hammerspoon
hi everybody,

I am trying to write a function to replace the currently selected text
with different text.

The problem is that if I use

hs.eventtap.keyStrokes(result)

the selected text is not overwritten.

If I use a clipboard:

hs.pasteboard.setContents(result)
hs.eventtap.keyStroke({"cmd"}, "v")

it works as expected, but... it does not work in applications that
have override cmd-V (for example emacs)

is there a way to generate the paste event directly?

thank you,


--
--dmg

---
D M German
http://turingmachine.org

M N

unread,
Aug 10, 2024, 7:40:34 PM8/10/24
to Hammerspoon
1) Send a deleted with sendkeys before the keysteokes to delete
2) you can do a Workaround to find the menu item for pasting an fire this 
Reply all
Reply to author
Forward
0 new messages