how to keyboard.send_keys((the contents of a string))

1,174 views
Skip to first unread message

cedardoc

unread,
Jun 22, 2010, 12:34:09 PM6/22/10
to autokey-users
I tried this:

keyboard.send_keys(finalitem"<enter>")

where finalitem is a string, and got this error:

Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/autokey/service.py", line
395, in execute
exec script.code in self.scope
File "<string>", line 14
keyboard.send_keys(finalitem"<enter>")
^
SyntaxError: invalid syntax


Is it currently possible to do this?

thanks,
Dave

ps I also tried it with the string inside square and regular brackets

Christiaan Dekter

unread,
Jun 22, 2010, 8:27:01 PM6/22/10
to autoke...@googlegroups.com
http://docs.python.org/tutorial/introduction.html

The above link gives a basic introduction to Python concepts, should give you the answer.

cedardoc

unread,
Jun 24, 2010, 10:13:34 AM6/24/10
to autokey-users
Sorry, I'd thought that "keyboard.send_keys" was an Autokey thing and
not a python thing.
Thanks for the link. When I figure it out I'll post here for others
who might want the same functionality.

Dave

On Jun 22, 6:27 pm, Christiaan Dekter <cdek...@gmail.com> wrote:
> http://docs.python.org/tutorial/introduction.html
>
> <http://docs.python.org/tutorial/introduction.html>The above link gives a
> basic introduction to Python concepts, should give you the answer.
>

Christiaan Dekter

unread,
Jun 24, 2010, 10:16:56 AM6/24/10
to autoke...@googlegroups.com
To get you out of trouble quickly:

keyboard.send_keys(finalitem + "<enter>")

A script in AutoKey is a Python script - the two are equivalent. So anything you could do in a separate Python script, you can do within an AutoKey script.

cedardoc

unread,
Jun 28, 2010, 1:00:50 PM6/28/10
to autokey-users
thanks, that worked.

Sorry I didn't think of trying that myself - I was under the
impression that using the plus sign meant the two things on either
side of the plus sign are pressed simultaneously, as in "<ctrl>+s",
but I'm just noticing that finalitem is not within the quotes - I bet
that's part of the answer.

anyways, many thanks for your work and patience!!

On Jun 24, 8:16 am, Christiaan Dekter <cdek...@gmail.com> wrote:
> To get you out of trouble quickly:
>
> keyboard.send_keys(finalitem + "<enter>")
>
> A script in AutoKey is a Python script - the two are equivalent. So anything
> you could do in a separate Python script, you can do within an AutoKey
> script.
>
Reply all
Reply to author
Forward
0 new messages