Daeaznar
Daeaznar

Reputation: 23

How to change the behavior of accents from ´ symbol to ` symbol

I have the following script for typing Spanish accents:

AppsKey::var := "´"

#if (var = "´"), var := ""
a::Send, á
e::Send, é
i::Send, í
o::Send, ó
u::Send, ú
+a::Send, Á
+e::Send, É
+i::Send, Í
+o::Send, Ó
+u::Send, Ú

If I run this then I have to type the ´ symbol (Acute accent - spacing acute) for the vowels to have the accent. This symbol is not "easy" to type on a US keyboard, so I want to change that for the following symbol: ` (Grave accent)

The issue is, when I change it on the script all the vowels have the accent always, not just when I press de grave accent symbol.

I don't know why this is and haven't been able to solve it. Does anybody know how?

Upvotes: 1

Views: 1996

Answers (2)

T_Lube
T_Lube

Reputation: 331

It seems that what you need is to use hotstrings instead of hotkeys, but declare a different escape character, so something like this:

#EscapeChar /
:*C:`a::á
:*C:`e::é
:*C:`i::í
Etc…

The asterisk in the first set of colons indicates that the hotstring will not wait for an end key such as space or enter to be pressed for the hotstring to fire. The capital C indicates that hotstring is case sensitive. What new escape char you use is up to you.

Upvotes: 1

Hovercouch
Hovercouch

Reputation: 2314

The grave accent is used in AHK as the escape sequence character. "`" isn't read as the string containing a grave, it's an open string containing a single ". You should be able to fix this back escaping the grave itself by writing "``".

Upvotes: 0

Related Questions