autokey icon indicating copy to clipboard operation
autokey copied to clipboard

Missing letter output

Open skupfer opened this issue 6 years ago • 15 comments

Classification:

Bug

Reproducibility:

Sometimes, nearly always

Version

AutoKey version: 0.95.10-0

Used GUI (Gtk, Qt, or both): Gtk

If the problem is known to be present in more than one version, please list all of those.

Installed via: dpkg -i

Linux Distribution:

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

Summary

When binding phrases / text to an hotkey, the input into a window (in this case firefox) is not complete and there are almost always letters missing. I tried splitting it into several actions with a sleep in between but it doesn't change that behaviour.

Steps to Reproduce (if applicable)

Bind phrase to Hotkey, press it

Expected Results

@reporter
 Account created. You will receive your credentials ad config in a separate mail.

Actual Results

@reporter
 Account created. You willreceive yourcredentials and config i a separte mail.

DEBUG

autokey -l

-> Expected Results - Hotkey F6 (List) -> Phrase

2020-03-03 14:45:32,480 DEBUG - service - Raw key: <Key.BACKSPACE: '<backspace>'>, modifiers: [], Key: Key.BACKSPACE
2020-03-03 14:45:32,481 DEBUG - service - Window visible title: 'New Issue · autokey/autokey - Mozilla Firefox', Window class: 'Navigator.Firefox'
2020-03-03 14:45:32,481 DEBUG - service - Undoing last phrase expansion requested. Can undo last expansion: False
2020-03-03 14:45:33,316 DEBUG - service - Raw key: <Key.F6: '<f6>'>, modifiers: [], Key: Key.F6
2020-03-03 14:45:33,317 DEBUG - service - Window visible title: 'New Issue · autokey/autokey - Mozilla Firefox', Window class: 'Navigator.Firefox'
2020-03-03 14:45:33,317 DEBUG - service - Matched Folder with hotkey - showing menu
2020-03-03 14:45:33,318 DEBUG - phrase-menu - Sorting phrase menu by usage count
2020-03-03 14:45:33,319 DEBUG - phrase-menu - Triggering menu item by position in list
2020-03-03 14:45:35,275 DEBUG - service - Script runner executing: Script('VPN Mail')
2020-03-03 14:45:35,275 DEBUG - iomediator - Send via event interface
2020-03-03 14:45:35,277 DEBUG - interface - Sending string: '@reporter'
2020-03-03 14:45:35,281 DEBUG - interface - Send special key: ['<enter>']
2020-03-03 14:45:36,076 DEBUG - iomediator - Send via event interface
2020-03-03 14:45:36,078 DEBUG - interface - Sending string: ' Account created. You will receive your credentials and config in a separate mail.'

-> Actual Results - Hotkey F6 (List) -> Phrase

2020-03-03 14:45:41,282 DEBUG - service - Raw key: <Key.BACKSPACE: '<backspace>'>, modifiers: [], Key: Key.BACKSPACE
2020-03-03 14:45:41,283 DEBUG - service - Window visible title: 'New Issue · autokey/autokey - Mozilla Firefox', Window class: 'Navigator.Firefox'
2020-03-03 14:45:41,283 DEBUG - service - Undoing last phrase expansion requested. Can undo last expansion: False
2020-03-03 14:45:41,801 DEBUG - service - Raw key: <Key.F6: '<f6>'>, modifiers: [], Key: Key.F6
2020-03-03 14:45:41,801 DEBUG - service - Window visible title: 'New Issue · autokey/autokey - Mozilla Firefox', Window class: 'Navigator.Firefox'
2020-03-03 14:45:41,801 DEBUG - service - Matched Folder with hotkey - showing menu
2020-03-03 14:45:41,802 DEBUG - phrase-menu - Sorting phrase menu by usage count
2020-03-03 14:45:41,802 DEBUG - phrase-menu - Triggering menu item by position in list
2020-03-03 14:45:44,156 DEBUG - service - Script runner executing: Script('VPN Mail')
2020-03-03 14:45:44,157 DEBUG - iomediator - Send via event interface
2020-03-03 14:45:44,159 DEBUG - interface - Sending string: '@reporter'
2020-03-03 14:45:44,166 DEBUG - interface - Send special key: ['<enter>']
2020-03-03 14:45:44,958 DEBUG - iomediator - Send via event interface
2020-03-03 14:45:44,960 DEBUG - interface - Sending string: ' Account created. You will receive your credentials and config in a separate mail.'

Notes

Script

keyboard.send_keys("@reporter<enter>")
time.sleep(0.8)
keyboard.send_keys(" Account created. You will receive your credentials and config in a separate mail.")

or

keyboard.send_keys("@reporter<enter>")
time.sleep(0.8)
keyboard.send_keys(" Account created. ")
time.sleep(0.8)
keyboard.send_keys("You will receive your credentials ")
time.sleep(0.8)
keyboard.send_keys("and config in a separate mail.")

skupfer avatar Mar 03 '20 13:03 skupfer

Have you tried putting your phrase into the clipboard and then pasting it into your application? That often works better. You can also do this with phrases by selecting the Paste using clipboard option. Some apps, notably Firefox and LibreOffice work better that way.

Sometimes apps can't keep up with the speed at which AutoKey types. If you need to type rather than paste, then check out my type_slow() function from our wiki that types character by character with a small programmable delay between each character.

josephj11 avatar Mar 04 '20 11:03 josephj11

I am also facing this problem.

Wouldn't it make sense to add a new configuration item, e.g. AUTOKEY_SLEEP_AFTER_CHAR_PASTE, to AutoKey -- maybe just to the config file, not even to the GUI -- with which the user could configure this pasting delay? By default it could be 0 and keyboard.send_keys() would work as before. If the alue is non-zero, keyboard.send_keys() would wait AUTOKEY_SLEEP_AFTER_CHAR_PASTE milliseconds after pasting each character?

miskovics avatar Jun 29 '20 08:06 miskovics

@miskovics I assume you mean "type", not "paste." If you put your text into the clipboard and then paste the clipboard into your application window, that usually works. For phrases you do that by selecting the Paste using clipboard option. For extreme situations, you can use my type_slow() function which emits one character at a time followed by a configurable delay.

josephj11 avatar Jun 30 '20 14:06 josephj11

@josephj11 Yes, sorry, I meant typing.

About the workaround of using clipboard pasting: I've already switched all of phrases to "Paste with clipboard", but they are still very unreliable. It seems that during the phase execution the clipboard is already restored before it is actually pasted. So the original trigger text is just deleted or replaced with something rubbish (which I have manually put on the clipboard before). Does pasting the clipboard actually block the execution? If not, can we insert some delay before the clipboard is restored?

miskovics avatar Jul 01 '20 17:07 miskovics

@miskovics When it's in a script, we recommend adding a delay between filling the clipboard and pasting it because (at least in Qt), the fill and paste operations return success instantly even though they're executing on another asynchronous thread. Same for pasting it and then restoring its previous content.

Obviously, you can't do that with a phrase, so if it's happening with phrases, the devs will have to look into it. I don't know much about such things, but it sounds to me like an upstream bug report is in order.

This issue references the GTK front end. Are you using that or the Qt front end? Knowing this is important for this issue.

josephj11 avatar Jul 02 '20 06:07 josephj11

@josephj11 I use the GTK front end on Ubuntu 20.04; and mainly phrases.

miskovics avatar Jul 02 '20 08:07 miskovics

I'm experiencing this with both GTK and Qt versions.

colemangit avatar Jul 16 '21 20:07 colemangit

@colemangit Try the type_slow() function linked above because AFAIK, no devs have worked on this issue yet. What application windows are you interacting with? If Firefox, is the problem just in the address bar or elsewhere?

josephj11 avatar Jul 16 '21 21:07 josephj11

Thanks for the suggestion! This is occurring while using phrases. I've reproduced the issue in multiple applications and it seems within anywhere you can input, address bar, or webpage (Firefox, Chrome, LibreOffice, Terminal)

Update: I've started using ctrl-V paste from clipboard option and it seems to be working fine from the clipboard now.

colemangit avatar Jul 16 '21 21:07 colemangit

Unless you dig into the source code and add a delay, the only workaround would be using scripts where you can slow things down as much as necessary. One of our former developers tried this before, but adding a delay long enough for everything made AutoKey very clunky to use.

josephj11 avatar Jul 16 '21 21:07 josephj11

@colemangit

Autokey's weakness is the keyboard speed. The only way to deal with it is, place it on the clipboard and paste it.

import time

i = 1
while i < 3:
    clipboard.fill_clipboard("")
    time.sleep(0.2)
    i = i + 1

nl = "\n"
begin_ = "@reporter" + nl*2
end_ = "Account created. You will receive your credentials and config in a separate mail."
paste_ = "<ctrl>+v"

time.sleep(0.1)
combined_ = begin_ + end_
time.sleep(0.1)`
clipboard.fill_clipboard(combined_)
time.sleep(0.1)
keyboard.send_keys(paste_)`

# OR clear clipbboard here
clipboard.fill_clipboard("")
time.sleep(0.4)```

P.S: The <enter> didn't make sense to me so I replaced it with carriage returns.

ineuw avatar Jul 16 '21 23:07 ineuw

@ineuw AFAIK, we don't need to use import time any more. The time module is available.

I don't know when or if this changed.

josephj11 avatar Jul 17 '21 07:07 josephj11

@allanlaal Thanks for the housekeeping! Hopefully we'll get this very long term problem resolved soon.

josephj11 avatar Dec 26 '21 14:12 josephj11

I'm thinking of closing this and #151 as won't fix because the workarounds almost always work and no one has been able to figure out a solution in over four years. Also, if we are able to change to new input/output methods to accomodate Wayland, this would have to start over anyway.

Any thoughts?

josephj11 avatar Mar 13 '23 09:03 josephj11

Yes to both. Although Ubuntu 18.04 isn't at EOL yet, it shipped with AutoKey 0.90.4 and each of these issues are about AutoKey 0.94.1 and AutoKey 0.95.10.

Elliria avatar Mar 13 '23 13:03 Elliria

Actually, AFAIK, 18.04 support ended last April. But using ubuntu-advantage extends it. I'm using it for now.

josephj11 avatar Mar 13 '23 14:03 josephj11

The Ubuntu wiki link that I posted above says that Standard Support ends next month (April of 2023) and EOL is in April of 2028. I'm not sure what that means for us. Does AutoKey stop supporting it when Standard Support ends or does it wait until EOL?

Elliria avatar Mar 14 '23 22:03 Elliria

Well, I'm surprised! Maybe it was extended for Covid. It sure doesn't feel that way though. Launchpad deleted all of the 18.04 PPAs a month or two ago. My VPN app won't run unless I use the previous version because of a dependency. I have another program I use a lot that cannot be upgraded to its current version.

We don't get concerned with anything about user's OSs or versions. We just need to know what we're dealing with whan answering questions.

If someone posts a question about 0.90.4, I'll try to answer it. I will tell them to upgrade.

Our developers work on whatever they want to. No one is going to try to figure out a major bug on an "unsupported" release. In this case, "unsupported" means no development or bug fixes ever again. We'd still answer any questions we could.

josephj11 avatar Mar 15 '23 11:03 josephj11

It seems to be their standard release schedule, but I think you're seeing a difference because Ubuntu flavors have a shorter life, with most of them having a 3-year cycle.

If I'm understanding this correctly, all but the most recent release would qualify as "unsupported" in the sense that they're frozen the way they are and nobody is going to touch them again. And even the most recent release would remain frozen, but a point-release might get put out based on that one if it's needed, right?

Elliria avatar Mar 15 '23 16:03 Elliria

It may have been kubuntu - aligning with your supposition.

Not quite. A lot of releases continue to get security updates for some extended period. they just stop getting new versions and enhancements of packages.

Optionally, you can add one or more backports repos to your sources and get more things that still work. I always do this.

josephj11 avatar Mar 16 '23 18:03 josephj11

I'd say the opposite happened in this issue. It seems like the OP somehow used dpkg to install an AutoKey release that wasn't available in Ubuntu 18.04.

Elliria avatar Mar 16 '23 20:03 Elliria

That is the recommended way to install AutoKey debs (that they hopefully got from us). 18.04 came with 0.90.4. We wouldn't want anyone using that.

josephj11 avatar Mar 17 '23 07:03 josephj11