Changing characters written depending on what follows
Changing characters written depending on what follows
Any idea how I could make a hotkey so that a specific letter (for instance L) followed by any other letter (except vowels) sends itself normally as always, but followed by a,e,i,o or u, sends a different thing, for instance R? It doesn't matter if the letter (L) is not visually written on screen until the next letter is sent, as it's expected.
Re: Changing characters written depending on what follows
Two examples you can work on:
https://autohotkey.com/docs/commands/Input.htm
https://autohotkey.com/docs/Hotstrings.htm
{Blind} - https://autohotkey.com/docs/commands/Send.htm#blind
https://autohotkey.com/docs/commands/Input.htm
Code: Select all
~l::
Input,c,VL1I
if InStr("aeioul",c)
Send % "{Blind}{bs 2}r" ((c="l")?"r":c)
return
Code: Select all
:*?z:la::
:*?z:le::
:*?z:li::
:*?z:lo::
:*?z:lu::
:*?z:ll::
Send % "{Blind}r" (((t:=SubStr(A_ThisHotkey,0))="l")?"r":t)
return
{Blind} - https://autohotkey.com/docs/commands/Send.htm#blind
Re: Changing characters written depending on what follows
Code: Select all
:*?z:'a::
:*?z:'e::
:*?z:'i::
:*?z:'o::
:*?z:'u::
Send % "{Blind}´" (((t:=SubStr(A_ThisHotkey,0))="'")?"´":t)
return
So this example is working great. In English when you use the apostrophe, it's normally followed by consonants, so it will work as always. However, when followed by a vowel, it will transform it just like with a Spanish keyboard: a>á, e>é, i>í, o>ó, u>ú.
It's also working for caps, when the caps lock is on (Á, É...). However, with any of the shifts keys, it turns the letter into Ä, Ë, etc. instead or Á, É... Actually, ¨ is the shift modificacion of ´ (what happens when you press and hold shift plus the accent key in a Spanish keyboard). So, now the result of this sequence (', shift + vowel) is Ä. not Á. I'm trying with getkeystate, but there's no difference.
Thanks a lot.
Re: Changing characters written depending on what follows
I'm trying to add conditions like these:
but I don't know exactly how to modify so that the vowel is capitalized but the accent is not (not turned from ´to ¨)
Code: Select all
if ( GetKeyState("Shift", "P") = 1 )
Code: Select all
Send % "{Blind}´" (((t:=SubStr(A_ThisHotkey,0))="'")?"´":t)
Re: Changing characters written depending on what follows
After some tests, I have it working as I wanted. If anyone is able to make it shorter and smarter, go ahead. Thanx.
Code: Select all
:*?z:'a::
:*?z:'e::
:*?z:'i::
:*?z:'o::
:*?z:'u::
if ( GetKeyState("Shift", "P") = 0 )
{
Send % "{Blind}´" (((t:=SubStr(A_ThisHotkey,0))="'")?"´":t)
return
}
if ( GetKeyState("Shift", "P") = 1 )
{
Send % "´{shift down}" (((t:=SubStr(A_ThisHotkey,0))="'")?"´":t)
send {shift up}
return
}
return