Keeweb: Auto-type with special characters not working on Mac

Created on 20 Jul 2016  路  4Comments  路  Source: keeweb/keeweb

Using Mac OS X 10.11.5.

I verified how the code creates an Applescript and spanws the execution of osascript with it. From what I checked, I got different results depending on the Input Source enabled on my OS.

This is a test script I created:

tell application "System Events"
keystroke "录"
keystroke "脦"
keystroke "漏"
keystroke "~"
keystroke "{"
keystroke "*"
keystroke "!"
keystroke "+"
keystroke "垄"
keystroke "f"
keystroke "4"
end tell

This is the result I got by running it having three different Input Sources selected:

  • U.S.: a脦漏~{*!+垄f4
  • Spanish - ISO: aa漏~{*!+垄f4
  • Brazilian - ABNT2: 录a漏~{*!+垄f4

Expected: 录脦漏~{*!+垄f4. Actually none of them got it right. :- (

Plus, we have to consider that the Input Source affects how an accented character is typed. In U.S. we would type as Alt+i, I. In Spanish - ISO or Brazilian - ABNT2 we would type it as ^, I. Maybe if we avoid using keystroke...

auto-type bug desktop

All 4 comments

Also, when Spanish - ISO or Brazilian - ABNT2 are enabled, a password like ^A~A麓A gets auto-typed as 脗脙脕 (and U.S. actually gave me ^A~A脕). You can use http://keepass.info/help/kb/testform.html to check. I'd consider using copy-paste for non-alphanumeric characters as a solution.

windows: ^ disappears, other characters are working
linux: some characters are either skipped, or typed incorrectly
So:

  • ^ and other modifiers must be escaped
  • for non-ascii characters, it's better to use copy-paste.

Status Update

  • mac generation has been switched to a native app and it works with different layouts

    • app size is huge, Swift is generating bloated executables, I'll rewrite it in Objective C but now it's working, and that's awesome

  • linux is now sending xdotool key U${code} instead of type ${text} and seems to work with different layouts

    • there's a bug with latin1-supplement characters, e.g. is typed as but this seems to be a bug of xdotool because it cannot type capital character by its name: xdotool key Aacute prints . This may be fixed in future, now we'll stick to xdotool on linux

  • windows, not so good here:

    • there's no standard method to simulate unicode user input (MSDN says: '_If your application is intended for international use with a variety of keyboards, the use of Send could yield unpredictable results and should be avoided_' but doesn't offer anything else), some keys cannot be sent even in English layout, needs hacking

Tested this on string !@#$%^&*()_+-={}[]:";'<>?,./泄褍褏^A~A麓A脗脙脕a脦漏~*!+垄f4 in English, Spanish - ISO, Brazilian - ABNT2 and Cyrillic layouts.

Current status

  • mac helper has been re-implemented and now it's 70KB, working with all layouts 馃専
  • windows switched to InputSimulator library, working with all layouts 馃帀
  • linux found more errors in some exotic characters, but we'll leave it as is for this release 馃樁
Was this page helpful?
0 / 5 - 0 ratings

Related issues

antelle picture antelle  路  3Comments

denisgarci picture denisgarci  路  4Comments

amine250 picture amine250  路  3Comments

philogit picture philogit  路  3Comments

fl0at picture fl0at  路  3Comments