AutoHotkey Community

It is currently May 27th, 2012, 8:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: January 17th, 2012, 9:09 pm 
Offline

Joined: January 17th, 2012, 8:30 pm
Posts: 4
AutoHotKey v1.1.05.06 (latest).
OS: WinXP 32bit

Code:
#b::
AutoTrim Off  ; Retain any leading and trailing whitespace on the clipboard.
ClipboardOld = %ClipboardAll% ; Copy old clipboard content to be sure
Clipboard =  ; Must start off blank for detection to work.
SendInput ^c ; Ctrl-C
SendInput <b>
SendInput ^v ; Ctrl-V
SendInput </b>
Clipboard = %ClipboardOld%  ; Restore previous contents of clipboard.
return


Let's imagine, that I have a string of numbers from 1 to 9:
Code:
123456789


I select numbers from 2 to 8 and press Win+B.

If I use Finnish (latin) keyboard layout I get:
Code:
1<b>2345678</b>9

So everything is ok.

But if I choose the Russian (cyrillic) layout and press the same buttons, I get either
Code:
1c<b>v;/b>9

or
Code:
1c<b>v</b>9
.

This is a big problem for me, which has been here for a few years now. I hoped that it would get noticed and fixed without me, but it wasn't, so I finally decided to report it myself.

And before you ask, Ctrl-C/V work (anywhere except AutoHotKey) in any of my layouts.


I also have had these bugs for a very long time:
http://www.autohotkey.com/forum/viewtopic.php?t=3437
http://www.autohotkey.com/forum/viewtopic.php?t=80725


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2012, 10:44 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Quote:
And before you ask, Ctrl-C/V work (anywhere except AutoHotKey) in any of my layouts.
If you press the key labelled "V" in the Finnish layout, does it produce a "v"? If not, it is not the "v" key when in that layout, and this is not a bug. AutoHotkey cannot read the physical labels on your keys. It only knows that the keyboard layout defines.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2012, 10:51 pm 
Offline

Joined: January 17th, 2012, 8:30 pm
Posts: 4
Lexikos wrote:
If you press the key labelled "V" in the Finnish layout, does it produce a "v"? If not, it is not the "v" key when in that layout, and this is not a bug. AutoHotkey cannot read the physical labels on your keys. It only knows that the keyboard layout defines.

Yes, it produces "v". I don't know why you are asking about that, because "everything" (except for other bugs) works fine in Finnish.

It doesn't work in Russian. And pressing v-button with Russian layout turned on doesn't produce "v". But it doesn't matter, because the Ctrl-c and Ctrl-v combinations do work regardless of the layout!

And since AutoHotKey sends these combinations, everything should work as well. Except that it doesn't work. A clear bug.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2012, 4:58 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
mixer wrote:
Yes, it produces "v". I don't know why you are asking about that, because "everything" (except for other bugs) works fine in Finnish.
My mistake. I meant to ask about the Russian layout.

You insist that Ctrl-V works regardless of the layout, but which key is V? There are a number of things which define a key's identity:
  1. The physical label on the key. The software running on your computer cannot see this.
  2. How you think of the key. The software running on your computer cannot read your mind.
  3. Which scancode is reported by the keyboard hardware.
  4. Which virtual keycode the operating system translates that scancode to.
  5. Which character the operating system translates that virtual keycode to. This heavily depends on the keyboard layout.
I presume the key which you call "v" produces "м" in the Russian layout, therefore the key you want to press is "м", not "v". In that case, you can Send ^м. Alternatively, you can use the key's scancode or virtual keycode: probably {sc02F} or {vk56}.

If AutoHotkey always sent {vk56} when asked to Send v, it would produce "м" in the Russian layout and other characters in other layouts. This clearly would not be correct. If there is no key in the current layout which produces "v", it is impossible to produce "v" by sending a keystroke; so it is necessary to use a fallback method. The fact that it does produce a "v" in your example demonstrates that it is working correctly.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group