Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Send command when switching to russian input language


  • Please log in to reply
6 replies to this topic
Max78
  • Guests
  • Last active:
  • Joined: --
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?

  • Guests
  • Last active:
  • Joined: --
Try with {shift} not +. Of course you can simply use W and omit the +.

:?:

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
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).

Max78
  • Guests
  • Last active:
  • Joined: --

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?

Max78
  • Guests
  • Last active:
  • Joined: --
Send +{vk57}
???

Max78
  • Guests
  • Last active:
  • Joined: --
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?

Deo
  • Members
  • 199 posts
  • Last active: Jan 31 2014 03:19 PM
  • Joined: 16 May 2010
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] "}"