Replies: 6 comments
-
This is definitely NOT a dumb question. It's new syntax as of 0.96.0 and I don't know the answer. Someone will have to add an example here once we get it to work. IDK the codebase very well, but This is the API doc
I found this in phrase.py
It looks like those may be integers from 0..4 or 1..5 representing the mode you want to use as listed above. It depends on whether a Python enum is zero- or one-based. As far as the complaint about number of arguments, I'm guessing that send mode has to be a keyword=value parameter, not just a value. I'm a Python newbie. Someone who actually knows Python will have to clarify this, but until they do, you can try some integer values like SendMode=1 or SendMode=KEYBOARD and see what happens. |
Beta Was this translation helpful? Give feedback.
-
My failed attempts:All efforts to add an argument to keyboard.send_keys("foo", SendMode=1) # TypeError: Keyboard.send_keys() got an unexpected keyword argument 'SendMode' and: keyboard.send_keys("foo", send_mode=1) # TypeError: Keyboard.send_keys() got an unexpected keyword argument 'send_mode' and: keyboard.send_keys("foo", 1) # TypeError: Keyboard.send_keys() takes 2 positional arguments but 3 were given and: keyboard.send_keys("foo", send_mode=engine.SendMode.CB_SHIFT_INSERT) # AttributeError: 'Engine' object has no attribute 'SendMode' and: keyboard.send_keys("foo", send_mode=engine.send_mode.CB_SHIFT_INSERT) # AttributeError: 'Engine' object has no attribute 'send_mode' Best guess:I believe this is a documentation error rather than a new feature. Possible explanation:@josephj11 is right that it comes from the I believe that the send_mode argument is handled internally by AutoKey. Specifically, by the value given to SendMode in the Possible work-around 1:Pick one:
Possible work-around 2:
Possible work-around 3:
|
Beta Was this translation helpful? Give feedback.
-
I created an issue for it in the documentation repository. |
Beta Was this translation helpful? Give feedback.
-
@Elliria I distinctly remember this being added as a feature, possibly by @BlueDrink9 . If it doesn't work or we can't figure out how to invoke it, it's a bug. |
Beta Was this translation helpful? Give feedback.
-
Ah, okay. In that case, I changed the tag from documentation to bug for this discussion and I'll close the PR I created in the documentation repository for it. This should probably get turned into an issue. |
Beta Was this translation helpful? Give feedback.
-
@Elliria Until now, we haven't been labelling discussions. It's fine if you want to though. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
Sorry for this apparently stupid question, but I cannot figure how to change
send_mode
ofkeyboard.send_keys
in a custom script as mentioned in APIIf I try to pass a
send_mode
argument by named argument or positional argument I got eitherTypeError: Keyboard.send_keys() got an unexpected keyword argument 'send_mode'
or
TypeError: Keyboard.send_keys() takes 2 positional arguments but 3 were given
Which hints that in a script, keyboard.send_keys is only a wrapper to autokey.scripting.Keyboard.send_keys, which only allows to pass text.
Could you provide a script example of keyboard.send_keys with the CB_CTRL_V modifier? (for libre office).
It is more to understand how to use autokey, I know that I can write to the clipboard and then use
keyboard.send_keys("<ctrl>+v")
Thanks.
package autokey 0.96.0, installed using Python 3.11.2
Beta Was this translation helpful? Give feedback.
All reactions