Re: How to send keys like Ctrl+C?

922 views
Skip to first unread message

Joe

unread,
Mar 19, 2015, 7:12:38 PM3/19/15
to autoke...@googlegroups.com
Nice try; It might work that way if you used the right name for the
control key, but the normal way to do it is with special constants for
things like that. See:

https://code.google.com/p/autokey/wiki/SpecialKeys

What you want is:
keyboard.send_keys("<Ctrl>+C")

and take a look at the rest of the wiki which has code examples too.

Joe

On 03/16/2015 02:57 PM, Matthew Greenfield wrote:
> How can I force pressing Ctrl+C? What I mean by this is holding down
> Ctrl, then pressing C, then releasing both.
>
> I tried the following, but it didn't work
>
> keyboard.press_key("<control>")
> keyboard.press_key("c")
> keyboard.release_key("c")
> keyboard.release_key("<control>")
> --
> 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
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Neeraj Hanumante

unread,
Jul 20, 2015, 11:21:44 PM7/20/15
to autoke...@googlegroups.com
Hi Joe,

I attempted the code as you mentioned, however, it ended up writing <Ctrl>+V etc. in the file (spreadsheet).

keyboard.send_key("<F2>")
keyboard
.send_keys("<Ctrl>+A")  
keyboard
.send_keys("<Ctrl>+X")
keyboard
.send_key("<enter>")
keyboard
.send_key("<up>")
keyboard
.send_key("<up>")
keyboard
.send_key("<F2>")
keyboard
.send_key("<END>")
keyboard
.send_keys("<Ctrl>+V")
keyboard
.send_key("<enter>")

What I am trying to do here is assigning hotkey to the action of joining the long text data in from source cell (e.g. D4)  to destination cell (e.g. D3).
Kindly point out my mistake/s.
Regards,
Neeraj

Joe

unread,
Jul 21, 2015, 5:05:08 PM7/21/15
to autoke...@googlegroups.com
I can't see your actual macro code from your email (Please include it in
your next reply)., but I'll assume you did it correctly. So the next
thing we need is more documentation of the problem including a trace.
See boilerplate below.

Joe

Standard reply to all such questions:

FAQ #1: When AutoKey does something unfortunate, document your problem
by specifying:
exactly what you did,
what it did,
what you expected it to do,
*and*
providing us with a trace log and a description of:

your OS/version
desktop manager/version
AutoKey version

and anything else you think might be relevant.

Quit AutoKey if it is currently running.

Start AutoKey from a terminal window.
Then, do the minimum required to recreate your issue and then stop AutoKey.

autokey-gtk -l
or
autokey-qt -l

depending on which version of autokey you have installed. That's a lower
case "ell".

This will produce a log in the terminal window of what AutoKey is doing.

It will probably show you what is wrong.

If it doesn't make sense or you have further questions, copy and paste
the log output from the terminal window into a post to this list and
we'll take a look at it.

Joe
> > an email to autokey-user...@googlegroups.com <javascript:>
> > <mailto:autokey-user...@googlegroups.com <javascript:>>.
> > an email to autokey-user...@googlegroups.com <javascript:>
> > <mailto:autokey-user...@googlegroups.com <javascript:>>.
> > an email to autokey-user...@googlegroups.com <javascript:>
> > <mailto:autokey-user...@googlegroups.com <javascript:>>.
Reply all
Reply to author
Forward
0 new messages