4

I am trying to understand this bug and I am looking for a workaroud.

Using this script:

#NoEnv
#SingleInstance force
SendMode Input
;Alt+t to send keystrokes
!t::Send, /[]

It send the correct keystrokes /[] to all windows but the windows console (cmd)

Additional Info:

  • Using autohotkey v1.1.09.02
  • With an english US keyboard layout, it sends: '90
  • With a french canadian multilingual keyboard layout, it sends: é^ç

Any idea of what can fix it?

user4157124
  • 2,809
  • 13
  • 27
  • 42
niroyb
  • 114
  • 6

1 Answers1

4

Try this:

#NoEnv
#SingleInstance force
;SendMode Input
;Alt+t to send keystrokes
!t::Send, % chr(047) chr(091) chr(093)
Return

And let me know if it solves your issues.

Found this:
I use multiple languages or keyboard layouts on my system. Why do Send and Hotstrings sometimes send the wrong characters? This can happen whenever the script's language or keyboard layout does not match that of the active window. To fix it, open the script's main window via its tray icon. While the main window is active, use the language bar (or a language hotkey such as LeftAlt+Shift) to change the script's language/layout to match that of the window you are currently typing in. Switching the script's language can be automated with the following example hotkey:

#l::   ; Win+L hotkey.
ListLines  ; Show the script's main window.
WinWaitActive ahk_class AutoHotkey
Send {LAlt down}{Shift}{LAlt up}  ; Switch to alternate language (keys must be in this format).
WinMinimize  ; Minimize the window found by WinWaitActive above.
return

More info: Like all applications, each script starts off using your default language. If the default does not match that of the active window (where the keystrokes are sent), the difference in keyboard layouts might cause keystrokes sent by the script to be translated into something unexpected.

On: http://autohotkey.free.fr/docs/FAQ.htm#load

Robert Ilbrink
  • 7,738
  • 2
  • 22
  • 32
  • Thank you for the help. This script has the same behaviour as the sendinput mode. I noticed that Autohotkey uses the previous keyboard layout when it is executed. To circumvent it, I start the script then change the keyboard layout. It does not seem like a reasonable fix. Any other ideas? – niroyb Apr 08 '13 at 17:29
  • Wow, so depending on your keyboard setting sending `/[]` is either sent as `'90` or when French keyboard is selected it becomes `é^ç`. I have never seen that before. Can you send the ASCCI codes? – Robert Ilbrink Apr 08 '13 at 17:36
  • Just updated the code with sending pure ascii. This should be keyboard driver independent (I hope). – Robert Ilbrink Apr 08 '13 at 18:39
  • Thanks again, sending pure ascii produces the same bug with cmd and has the same workaround. I guess I will use the fix. – niroyb Apr 09 '13 at 07:16
  • Wow, Even sending pure Ascii did not solve the problem! These keyboard drivers can really mess things up can't they! Glad to see that the "workaround" helped out! Thank you for checking the answer, even though the real answer came from the French website. – Robert Ilbrink Apr 09 '13 at 07:47
  • try this explanations and automatic workaround for syncing script's and app's layouts http://www.script-coding.com/AutoHotkey/AhkRussianEng.html – OJ287 Jun 10 '18 at 06:02