kit icon indicating copy to clipboard operation
kit copied to clipboard

keyboard.type sometimes skips repeated letters

Open eddiemcconkie opened this issue 6 months ago • 2 comments

Platform: Windows Version: 3.33.0

I have a text expansion script for my GitHub profile:

metadata = {
  expand: "gh;;",
  exclude: true,
};

await keyboard.type("https://github.com/eddiemcconkie");
https://github.com/eddiemcconkie // Expected
https:/github.com/ediemconkie    // Actual

The t's in https both make it in, but any other repeated characters get skipped.

eddiemcconkie avatar May 29 '25 19:05 eddiemcconkie

@eddiemcconkie fwiw, it's almost always better to use:

await setSelectedText("https://github.com/eddiemcconkie");

So that it just "pastes" it.

keyboard.type is incredibly difficult to debug based on OS/version/etc. If you're familiar with writing TypeScript/node, it's probably best to install the library Script Kit uses https://www.npmjs.com/package/@jitsi/robotjs in your ~/.kenv, then import and try some variations yourself. Does that make sense?

johnlindquist avatar May 29 '25 19:05 johnlindquist

That makes sense! I'll switch over to setSelectedText then

eddiemcconkie avatar May 29 '25 20:05 eddiemcconkie