Hotstrings not working with accent (diacritics) in UWP Topic is solved

Report problems with documented functionality
orlando2bjr
Posts: 2
Joined: 15 Nov 2017, 07:22
Contact:

Hotstrings not working with accent (diacritics) in UWP

15 Nov 2017, 07:45

When a hotstring has a diacritic (ç, ã, ô) it doesn't trigger on UWP based apps such as Sticky Notes, Edge, OneNote, etc...
Tested on several machines (Surface Pro 3, LG Gram, built desktop system), several keyboards (ABNT2, US, mechanical, chiclet) and US and PT-BR layouts.
link to gif to steps on onedrive
Steps:
Script

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
::pôr::por
::de::dê
  1. Run sample script
  2. Open Sticky Notes and Notepad
  3. Try triggering sample hotstrings on both apps.
  4. Try triggering on Edge, Word 2016, Word Mobile... etc for comparison.
However, Fastkeys dev has reported that he couldn't reproduce the bug. Maybe it's related to windows locale?
Please, can anyone confirm, suggest fixes?
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Hotstrings not working with accent (diacritics) in UWP

27 Dec 2017, 20:18

I found this in my notes:
fix CollectInput etc to use keyboard layout of *focused control*
I can't remember why I added it to my notes, but after reading it I remembered this bug report.

UWP apps use a weird window hosting model, where the top-level window is owned by a different process to the actual app window and controls. When you change keyboard layout, it only affects the thread which owns the control, not the active window. Send, hotstrings and Input all use the keyboard layout of the active window, so they all have these issues.

It is easy to confirm even with the US and UK keyboard layouts:
  • Use F1::Send @.
  • Focus Edge's address bar.
  • Press F1.
  • Swap layouts and press F1 again.
One press produces @ and the other produces ".

I believe that changing Send and the keyboard hook to retrieve the focused control (instead of just the active window) will fix this.
orlando2bjr
Posts: 2
Joined: 15 Nov 2017, 07:22
Contact:

Re: Hotstrings not working with accent (diacritics) in UWP

28 Dec 2017, 06:35

I imagined it had something to do with UWP weird window hosting, but had no idea how. It really makes sense how you put it. Also, I'd never imagine it affects Input as well.

I'll try working around this and hope ahk 2 comes with a fix wrapped in it at least :D
Nice catch!
Thanks for looking into it ;)

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 13 guests