Jump to content


Send command when switching to russian input language


  • Please log in to reply
6 replies to this topic

#1 Max78

Max78
  • Guests

Posted 07 December 2011 - 08:47 AM

Hi Guys!

I use simple script in Windows 7

F3::Send +w

The problem is: when I am at English language everithing is ok and I get "W" if I press F3. But if I switch to Russian language I get "w". So it is like "+" modifier stops to work.

Can you confirm it?

#2 Guests

  • Guests

Posted 07 December 2011 - 09:48 AM

Try with {shift} not +. Of course you can simply use W and omit the +.

:?:

#3 Lexikos

Lexikos
  • Administrators
  • 8845 posts

Posted 07 December 2011 - 12:50 PM

Does the character "w" actually exist on the Russian keyboard layout? If so, can you produce "W" by combining Shift with "w"? Send and related commands work via the target window's keyboard layout. If the character does not exist on that layout, modifying it with a Shift keystroke will have no effect, since it is the keyboard layout that defines what the modified character would be. Therefore, if the answer to either of the previous two questions is "no", "+w" will never produce "W" on the Russian layout (and this is by design, not a bug).

#4 Max78

Max78
  • Guests

Posted 07 December 2011 - 05:42 PM

Does the character "w" actually exist on the Russian keyboard layout? If so, can you produce "W" by combining Shift with "w"? Send and related commands work via the target window's keyboard layout. If the character does not exist on that layout, modifying it with a Shift keystroke will have no effect, since it is the keyboard layout that defines what the modified character would be. Therefore, if the answer to either of the previous two questions is "no", "+w" will never produce "W" on the Russian layout (and this is by design, not a bug).


Seems you right about layout. I think the reason that w is absent in russian layout.

Can you please advace me what to do in the following situation: I need to send Shift+w combination to the application in which I am part time in russain language and part time in English. What send command should I write to make sure that in both cases I send shift+w and not just w?

#5 Max78

Max78
  • Guests

Posted 07 December 2011 - 05:48 PM

Send +{vk57}
???

#6 Max78

Max78
  • Guests

Posted 07 December 2011 - 06:29 PM

I think I get it. It depends on what application expects. If it really needs to have shift+w so just Send W in any layout, but if it needs +vk or +sc so send it. Simple :)

Am I right?

#7 Deo

Deo
  • Members
  • 199 posts

Posted 14 December 2011 - 07:15 PM

not exactly
it just trying to find required character in you current keyboard layout
W does not exist in russian layout, and thus it wont work
hotkey commands will not work either
it depends not on your currently selected language, but exactly on your default layout - you must have it english in order it could work

OR
you need to use virtual key codes always

here is a workaround i used to make any hotkeys working on any language
KeyboardLayoutList()
{
	hkl_num := 20
	VarSetCapacity(hHkls,hkl_num*A_PtrSize,0)
	num := DllCall("GetKeyboardLayoutList","Uint",hkl_num,"Ptr",&hHkls)
	hkl_list := Array()
	loop,% num
		hkl_list.Insert(NumGet(hHkls,(A_index-1)*A_PtrSize,"UPtr"))
	hHkls =
	return hkl_list
}

GetVKList( letter )
{
	SetFormat, Integer, Hex
	vk_list := Array()
	for i, hkl in KeyboardLayoutList()
	{
		retVK := DllCall("VkKeyScanExW","UShort",Asc(letter),"Ptr",hkl,"Short")
		if (retVK = -1)
			continue
		vk := retVK & 0xFF
		StringTrimLeft,vk,vk,2
		if !instr(_list,"|" vk "|")
		{
			_list .= "|" vk "|"
			vk_list.insert(vk)
		}
	}
	SetFormat, Integer, D
	return vk_list
}
GetVKList() returns arrays of all vk acceptable for your current layouts. Most probably it will have only one, though
here is a simple solution for your case:
SendInput,% "+{vk" GetVKList("W")[1] "}"