Pasting text from the clipboard instead of inserting text from the keyboard

237 views
Skip to first unread message

Yekutiel ben Heshel

unread,
Nov 7, 2019, 2:50:14 AM11/7/19
to autokey-users
Hi Everyone,

This works...

import time
time
.sleep(0.1)
keyboard
.send_keys('''Sentence 1
Sentence 2
Sentence 3
and so on...'''
)
 
However, instead of having AutoKey insert the strings from the keyboard, I’d like to AutoKey to paste the strings from the clipboard. Of course this is similar to how one can choose to paste from the clipboard when creating a phrase in AutoKey which is depicted in the following screenshot...

AutoKey screenshot 2019-11-06_23-39.png








After some searching on Google I installed [pyperclip 1.7.0](https://pypi.org/project/pyperclip/). I also installed xclip (because I'm using Linux). Then I created the following script named XYZ in AutoKey...

import time
time
.sleep(0.1)
import pyperclip
pyperclip
.copy('Testing 123')
pyperclip
.paste()

After I ran it, I received the following error message...
 
"The script XYZ encountered an error."
 
I'd appreciate some helpful suggestions.

Thanks,

Yekutiel

jack

unread,
Nov 7, 2019, 2:53:17 AM11/7/19
to autoke...@googlegroups.com, Yekutiel ben Heshel
hi  yikutiel


try the examples at:

    https://github.com/autokey/autokey/wiki/API-Examples#clipboard


does that help?


cheers

jack
That would be telling...we want information...information...information!
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autokey-users/26cb5811-5412-4c67-9dcc-1e07b1f582c7%40googlegroups.com.

Yekutiel ben Heshel

unread,
Nov 7, 2019, 4:27:27 AM11/7/19
to autokey-users
Thank you Jack for your quick replay and the very helpful link! Yes that link helped me very much.

By studying the examples at https://github.com/autokey/autokey/wiki/API-Examples#clipboard I was able to create a script that functions as I had envisioned.

I should be sure to keep in mind the adage, "When all else fails try follow the instructions."

Thanks Again,

Yekutiel
To unsubscribe from this group and stop receiving emails from it, send an email to autoke...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages