Lshift executes differently than Rshift, even if mapped to Rshift Topic is solved

Report problems with documented functionality
Bernd
Posts: 56
Joined: 03 Sep 2016, 13:56

Lshift executes differently than Rshift, even if mapped to Rshift

Post by Bernd » 01 Sep 2021, 14:37

On my computer (Windows 10, German keyboard layout), the following script will executes differently, depending on whether Lshift or Rshift is pressed:

Code: Select all

StringCaseSense, On	

LShift::RShift

:::
	{
	SendInput :
	}
return

:?c*:.::
	{
	SendInput *
	}
return
. RShift + . gave *: (as expected).
. LShift + . gave **
I also suspect that LShift leads to hotkeys triggering themselves (often a "71 hotkeys in the last xxx ms" popup) whereas RShift does not.

Can anybody confirm this? Is this just a Windows problem or a bug in AHK?

Bernd
Posts: 56
Joined: 03 Sep 2016, 13:56

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by Bernd » 05 Sep 2021, 17:04

I solved it by replacing : by SendInput {U+003A}, without mapping.

Code: Select all

:::
	{
	SendInput {U+003A}
	}
return
It is the only way where LShift and RShift behave the same, though it beats me why exactly.
I think there should be a notice in the AHK manual, as colons are difficult to handle due to them being used to set up hotstrings.

Yes, I know this code looks silly, but it is just a minimum example from a larger code :)

gregster
Posts: 8886
Joined: 30 Sep 2013, 06:48

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by gregster » 06 Sep 2021, 05:18

I think that's an individual problem on your system, or rather with your scripts. I assume other scripts (or the rest of your actual script) or other programs are interfering in this case.
I couldn't reproduce your observations, also using a german keyboard layout, and I have never heard of this LShift/RShift problem before.


To avoid that a hotkey triggers itself, you can add the $ modifier. But tbh, based on the code I see, I don't know why you need that : hotkey at all.

Just using the hotstring

Code: Select all

:?c*:.::
	SendInput *
return
already gives me the expected result. Alternatively, the hotkey .::Sendinput * .
In both cases, pressing Shift and . still yields : (no matter what shift), which is the standard behaviour on a german keyboard layout.

Do you also have problems with your shifts when there is no AHK script running at all ?

Bernd
Posts: 56
Joined: 03 Sep 2016, 13:56

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by Bernd » 07 Sep 2021, 12:11

Thanks @gregster, the script works with every character except for : itself.

I cannot use the $ modifier [I've tried] as it renders the hotstring blind to any if... statements.

So my only solution is to escape it to {U+003A}.

gregster
Posts: 8886
Joined: 30 Sep 2013, 06:48

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by gregster » 07 Sep 2021, 12:23

So far, I strongly doubt that this is an AHK bug, or a Windows problem. This is not the standard behaviour of a german keyboard layout.
I suspect that the problem lies somewhere in your script(s), or potentially some third-party software.

I cannot use the $ modifier [I've tried] as it renders the hotstring blind to any if... statements.
This is unclear. I said to use it with a hotkey, not with a hotstring (of which it is not an option) - well actually, the whole ::: hotkey seemed pretty superfluous on a german layout, at least based on the posted code. So how did you use it?
Do you mean #if... directives (starting with a # ?) I don't see any in your posted code. I don't see any if-statements either. What do you mean by the described effect (renders... blind)?
Without seeing some standalone code that allows to reproduce your problems this probably won't lead anywhere. Here (Win10, german layout, AHK v1.1.33.10 Unicode), your so far posted code works as expected.

Bernd
Posts: 56
Joined: 03 Sep 2016, 13:56

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by Bernd » 07 Sep 2021, 14:50

As I said, it looks silly because it's just a minimum example :)

Code: Select all

:::
	{
	if ImSinn = :
		{
		SendInput `b⸬
		ImSinn = ⸬
		}
	else if ImSinn = .
		{
		SendInput `b⸫
		ImSinn = ⸫
		}
	else
		{
		SendInput {U+003A}
		ImSinn = :
		}
	}
return
Does the $ modifyer deliver ⸬ and ⸫ on your computer?

gregster
Posts: 8886
Joined: 30 Sep 2013, 06:48

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by gregster » 08 Sep 2021, 05:02

Let's start from your original problem... you are having different results with LShift and RShift. I asked before, but didn't get an answer: If no AHK script is running, are you also seeing the differences?
Can we agree that - on your german keyboard layout, no script running - pressing LShift or RShift and . always yields a : ?

Bernd wrote:
07 Sep 2021, 14:50
Does the $ modifyer deliver ⸬ and ⸫ on your computer?
How could it return with this code ? ImSinn never gets set to . in this code.

For me, this code alternates between : ("unicode colon", U+003A) and backspace (`b), then (a "squared four dot", U+2E2C), as I would also expect from looking at the code. I see no difference between using LShift and RShift.
What do you get? What do you expect?
If you get something else? What it is? Are you really running no other scripts, and just this code posted above?

But I see now, what you mean. $::: gets interpreted by AHK as a remapping of $ to :.
As : is no key on a german layout anyway, I would use Shift and . instead:

Code: Select all

+.::msgbox		; press Shift and .
Then you could also use the $ modifier:

Code: Select all

$+.::Send :
If I replace ::: with +.:: or $+.:: in your latest code, I still get the expected result, same as before. It alternates between : and - no matter what Shift I use.


I also still can't reproduce the problem from your first post. If I use that code, I always get * (if I press .) and : (if I press the shifted . key).
Which Shift doesn't matter, like expected.
Did you try that code yourself as standalone? Not in your larger script, but just this code in a new script, while absolutely no other scripts are running ?

Bernd
Posts: 56
Joined: 03 Sep 2016, 13:56

Re: Lshift executes differently than Rshift, even if mapped to Rshift  Topic is solved

Post by Bernd » 08 Sep 2021, 13:38

Can we agree that - on your german keyboard layout, no script running - pressing LShift or RShift and . always yields a : ?
-- Yes.

Ups, here is the missing part:

Code: Select all

:?c*:.::
	{
	SendInput .
	ImSinn = .
	}
return
Now you should be able to get ⸫ .

Strange, now all your codes work... but I noticed my Windows had an update this morning. Could they have screwed up the keyboard driver before and fixed it now?

gregster
Posts: 8886
Joined: 30 Sep 2013, 06:48

Re: Lshift executes differently than Rshift, even if mapped to Rshift

Post by gregster » 13 Sep 2021, 07:08

Bernd wrote:
08 Sep 2021, 13:38
Strange, now all your codes work... but I noticed my Windows had an update this morning. Could they have screwed up the keyboard driver before and fixed it now?
It seems no one could reproduce your problem, or encountered it before. So I still doubt that it was a general Windows (or AHK) problem.

Post Reply

Return to “Bug Reports”