Hi there,
I'm primarily a linux user and new to AHK scripting.
Being bilingual I frequently use accented characters á, é, í, ó, ú, for example which are easy enough in Windows simply by using <AltGr>+<key> but I need other accents too such as the cedilla, accent grave and ^
In linux I am used to using
<AltGr>+; followed by the letter to produce á etc
<AltGr>+' followed by letter to produce â and
<AltGr>+# followed by letter to produce à
I'd like to ( if possible ) use AHK to emulate at least these three and ideally other symbols too so that my Windows Keyboard layout largely mirrors the Linux one. I tried the windows keyboard layout creator but found it entirely unhelpful as it's not ( tired dyslexic brain can't remember the word for when something is natural to use ) and I don't want to have to define an entire layout from the ground up anyway. Just partly override my current one.
I found a script here that claims to do what I need but uses different triggers. I want to use my triggers ; ' and # respectively for consistency with Linux ( English International )
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=82484&hilit=accents
I can't make this script work the way I want it to though
Can anyone school me in what's going on?
Thanks
Ruth
I wan to emulate linux keyboard input
Re: I wan to emulate linux keyboard input
It's hard to say what's going on without seeing your script, but the following may work.
Explained: AltGr
Code: Select all
<^>!;::á
<^>!'::â
<^>!LWin::à
Re: I wan to emulate linux keyboard input
That's not exactly what I'm looking for. The script I'm trying to modify is linked in the first post. What I want to do is:mikeyww wrote: ↑19 Apr 2021, 04:54It's hard to say what's going on without seeing your script, but the following may work.
Explained: AltGrCode: Select all
<^>!;::á <^>!'::â <^>!LWin::à
press AltGr and ; together and THEN press any of the vowels aeiou and have them come out on the screen as áéíóú respectively
I have tried to modify the linked script but all it does is print the accented characters without requiring the trigger. My modified script is this:
Code: Select all
#SingleInstance
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
global Trigger:=0
<^>!;::Trigger :=1
if (Trigger = 1 )
{
:C*?:a::
SendInput {U+00E1} ; á
Trigger := 0
return
:C*?:A::
SendInput {U+00C1} ; Á
Trigger := 0
return
:C*?:e::
SendInput {U+00E9} ; é
Trigger := 0
return
:C*?:E::
SendInput {U+00C9} ; É
Trigger := 0
return
:C*?:i::
SendInput {U+00ED} ; í
Trigger := 0
return
:C*?:I::
SendInput {U+00CD} ; Í
Trigger := 0
return
:C*?:o::
SendInput {U+00F3} ; ó
Trigger := 0
return
:C*?:O::
SendInput {U+00D3} ; Ó
Trigger := 0
return
:C*?:u::
SendInput {U+00FA} ; ú
Trigger := 0
return
:C*?:U::
SendInput {U+00DA} ; Ú
Trigger := 0
return
:C*?:c::
SendInput {U+00E7} ; ç
Trigger := 0
return
:C*?:C::
SendInput {U+00C7} ; Ç
Trigger := 0
return
:C*?:n::
SendInput {U+00F1} ; ñ
Trigger := 0
return
:C*?:N::
SendInput {U+00D1} ; Ñ
Trigger := 0
return
:*?:!::
SendInput {U+00A1} ; ¡
Trigger := 0
return
:*?:?::
SendInput {U+00BF} ; ¿
Trigger := 0
return
Trigger := 0 ;; should but doesn't reset it for any other character
}
Re: I wan to emulate linux keyboard input
Code: Select all
<^>!;::accent(1)
<^>!'::accent(2)
accent(set) {
Static acc := [{a: "á", e: "é", i: "í", o: "ó", u: "ú"}, {a: "b", e: "c"}]
SoundBeep, 1500
Input, key, L1T1
If (ErrorLevel = "Timeout" && key = "")
SoundBeep, 1000
Else Send % acc[set].HasKey(key) ? acc[set][key] : key
}
Re: I wan to emulate linux keyboard input
Ooh shiny! Thank you
I think I understand the second one better
I will have a go adding extra triggers for other characters and see what I can come up with.
I think I understand the second one better
Code: Select all
acc1 := {a: "á", e: "é", i: "í", o: "ó", u: "ú"}
<^>!;::
SoundBeep, 1500
Input, key, L1
Send % acc1[key]
Return
Who is online
Users browsing this forum: Google [Bot] and 187 guests