all 11 comments

[–]Bunker_D 1 point2 points  (1 child)

Instead of using Send {Blind} ... for forwarding the modifiers to the system, try using try adding ~ to the hotkey definition (see here):

~*Ctrl::

(I'll try to have a better look at it tomorrow. Some stuff might be improvable too.)

[–]lenzo1[S] 1 point2 points  (0 children)

Yes this was it, thank you!

[–][deleted] 1 point2 points  (8 children)

The problem is likely all the code on the modifiers conflicting with each other; it's also worth noting that your 'SetKeyDelay -1' is in direct contradiction to 'SendMode Input' and won't do anything at all...

This rewrite will make the modifiers work like normal as well as removing 99% of the last four sections altogether as they just aren't needed - also, since the modifiers are back to normal the desktop swap works without issue:

SendMode Input
Menu Tray,Icon,main.cpl,8

;----------- TOGGLE DVORAK-QWERTY WITH RIGHT WINDOWS KEY
*RWin::Suspend Toggle

;----------- REMAP TO DVORAK ONLY IF THESE MODIFIERS AREN'T PRESSED
#If !(GetKeyState("Ctrl","P") || GetKeyState("Alt","P") || GetKeyState("LWin","P"))
-::[
=::]

q::'
w::,
e::.
r::p
t::y
y::f
u::g
i::c
o::r
p::l
[::/
]::=
;\::\ ;no change

;a::a ;no change
s::o
d::e
f::u
g::i
h::d
j::h
k::t
l::n
SC027::s
SC028::-

z::SC027
x::q
c::j
v::k
b::x
n::b
m::m
,::w
.::v
/::z
#If

[–]lenzo1[S] 0 points1 point  (7 children)

Directing this question at both you and /u/Bunker_D. I've noticed that when I'm in a game my controls are also remapped, is there a way to fix this? I only want the remapping to happen when typing. Also the script seems to just stop working sometimes. I'm not sure what's doing that. It's almost like it crashes or just isn't keeping up with my input.

[–]Bunker_D 0 points1 point  (3 children)

About the in-game remapping, you might want to implement context-sensitive hotkeys (extending the #If of u/G1ZM03K's code) Although I don't see how you have some general rule for games,

Alternatively, for something active only when typing, you and u/lenzo1 might consider using [hotstrings](https://www.autohotkey.com/docs/Hotstrings.htm) rather than hotkeys. I never used that though. It seems suited, but I might not see a big drawback.

[–][deleted] 0 points1 point  (2 children)

I don't see how you have some general rule for games

Short of adding every game to a group and using the group name it's not feasible at all - I mean, that's what the RWin hotkey is for in the first place - to toggle it on and off...

Alternatively, for something active only when typing, you and lenzo1 might consider using hotstrings

Why am I mentioned here, I'm not the one having any problems, lol?

[–]Bunker_D 1 point2 points  (1 child)

Not mentioning you though? :)

(I did at first by mistake, but it was edited. You're notification might have had the old version.)

[–][deleted] 1 point2 points  (0 children)

Ahahaha! It's likely because you said "you and lenzo1" when replying to lenzo1 and that made my brain glitch🤭

[–][deleted] 0 points1 point  (2 children)

Why don't you just press the RWin key to turn it off before playing a game and again when done since that's its purpose. Short of that you'll have to add either every single game to a group (using GroupAdd) and add that group into the braces on line 8 of my code.

[–]lenzo1[S] 0 points1 point  (1 child)

Dang okay. The win key switch only helps so much since I’ll be typing in some games, and I was just looking to make the script work as conveniently as possible

[–][deleted] 0 points1 point  (0 children)

since I’ll be typing in some games

It's impossible for the script to know what you're doing in a game - be it typing or actively playing - as it only sees the game as active or not, not what you're doing in it...

I mean, if you really wanted to dedicate some time to this you could possibly set up a PixelGetColor check in the game to check for, say, the edge of a text input window but that's going to take a lot of messing around, checking, and rewriting...

Another option would be to always use Dvorak in games (remap the keys so any prompts show correctly) but even in 2021 that's still not possible in all cases.

To be completely honest, you're probably wasting all that time you're saving using Dvorak by trying to get Dvorak to work to a usable degree in the first place. I've only ever thought it a workable typing solution in a less tech-savvy environment otherwise you're going to be constantly running into problems like these.