As I had said, I realized I didn't need the {} brackets, but I used them for organization reasons.
Anyway, as for an update, over the past week I slowly worked on this. And I ended up going down the
route. Which I had trouble finding examples on the forum for because, well, the term is used for more than just the command (understandably). So there was a lot of back and forth.
So here is the final script. It could be cleaned up a little, and streamlined, but it works as is.
In it it translates keyboard keys to Norse Runic. It will detect specific key strokes "ng", "th", and "ts" to do proper runic characters.
it also has a little overlay in the top left corner to display when runic mode is on.
Code: Select all
#InstallKeybdHook
#InstallMouseHook
#UseHook
#KeyHistory
#MaxThreadsPerHotkey 10
Runic := 0
RMR = ᚱᚢᚾᛁᚲ ᛗᛟᛞᛖ ᛖᚾᚨᛒᛚᛖᛞ ;Will not show up correctly if not set to UTF-8 Encoding. "UTF8 without BOM" also does not work.
RME = Runic Mode Enabled
Gui RuneDisplay:Default ;Setting Active GUI
Gui +AlwaysOnTop -Caption
Gui Font, s18 c666666 w600, FreeMono ;Setting Border Color
;FreeMono font - https://www.gnu.org/software/freefont/
;RMR Text Border
Gui Add,text,Center BackgroundTrans xm+0 ym+0, %RMR%
Gui Add,text,Center BackgroundTrans xp+0 yp+2, %RMR%
Gui Add,text,Center BackgroundTrans xp+2 yp-0, %RMR%
Gui Add,text,Center BackgroundTrans xp+0 yp-2, %RMR%
;RMR Text
Gui Font, s18 cffffff w600, FreeMono
Gui Add,text,Center BackgroundTrans xp-1 yp+1, %RMR%
;RME Border
Gui Font,c6611cc
Gui Add,text,xm+0 ym+26 Center BackgroundTrans, %RME%
Gui Add,text,xp+0 yp+2 Center BackgroundTrans, %RME%
Gui Add,text,xp+2 yp+0 Center BackgroundTrans, %RME%
Gui Add,text,xp+0 yp-2 Center BackgroundTrans, %RME%
Gui Font,ccc66FF
;RME Text
Gui Add,text,xp-1 yp+1 Center BackgroundTrans, %RME%
;Making GUI transparent
Gui Color, 000000
Gui +LastFound
WinSet, TransColor, 000000 140
^sc0046:: ;Ctrl-ScrollLock
++Runic
if Runic = 1 ;Enabling Runic
{
Gui RuneDisplay:show, x10 y10 autosize NoActivate, Runic ;Showing GUI
;Using ~ for detection purposes.
;Using * to ignore modifiers. Would prefer just shift
;But I'm not seeing a sleek solution for something like this
hotkey, *a, ansuz, on
hotkey, *b, berkanan, on
hotkey, *c, kaunan, on
hotkey, *d, dagaz, on
hotkey, *e, ehwaz, on
hotkey, *f, fehu, on
hotkey, *~g, gebo, on
hotkey, *~h, hagalaz, on
hotkey, *i, isaz, on
hotkey, *j, jera, on
hotkey, *k, kaunan, on
hotkey, *l, laguz, on
hotkey, *m, mannaz, on
hotkey, *n, naudiz, on
hotkey, *o, othila, on
hotkey, *p, perth, on
;Disabling some due to detection methods
;Leaving them in as a "incase" measure
;hotkey, *q, ingwaz, on
hotkey, *r, raido, on
hotkey, *~s, sowilo, on
hotkey, *t, tiwaz, on
hotkey, *u, uruz, on
hotkey, *v, wunjo, on
hotkey, *w, wunjo, on
;hotkey, *x, thurisaz, on
hotkey, *y, ihwaz, on
;hotkey, *z, algiz, on
return
}
if Runic != 1 ;Disabling Runic
{
Runic := 0
gui RuneDisplay:hide ;Hiding GUI
hotkey, *a, ansuz, off
hotkey, *b, berkanan, off
hotkey, *c, kaunan, off
hotkey, *d, dagaz, off
hotkey, *e, ehwaz, off
hotkey, *f, fehu, off
hotkey, *g, gebo, off
hotkey, *h, hagalaz, off
hotkey, *i, isaz, off
hotkey, *j, jera, off
hotkey, *k, kaunan, off
hotkey, *l, laguz, off
hotkey, *m, mannaz, off
hotkey, *n, naudiz, off
hotkey, *o, othila, off
hotkey, *p, perth, off
;hotkey, *q, ingwaz, off
hotkey, *r, raido, off
hotkey, *s, sowilo, off
hotkey, *t, tiwaz, off
hotkey, *u, uruz, off
hotkey, *v, wunjo, off
hotkey, *w, wunjo, off
;hotkey, *x, thurisaz, off
hotkey, *y, ihwaz, off
;hotkey, *z, algiz, off
return
}
return
;==============Defining Runic Bindings==============
; Labels are the name of the runes
; Additional Detection for Runes for ng, th, and ts
ansuz:
sendinput {U+16A8} ;A - ᚨ - a
return
berkanan:
sendinput {U+16D2} ;B - ᛒ - b
return
kaunan:
sendinput {U+16B2} ;C - ᚲ - k
return
dagaz:
sendinput {U+16DE} ;D - ᛞ - d
return
ehwaz:
sendinput {U+16D6} ;E - ᛖ - e
return
fehu:
sendinput {U+16A0} ;F - ᚠ - f
return
gebo:
send {backspace 1}
sendinput {U+16B7} ;G - ᚷ - g
return
hagalaz:
send {backspace 1}
sendinput {U+16BA} ;H - ᚺ - h
return
isaz:
sendinput {U+16C1} ;I - ᛁ - i
return
jera:
sendinput {U+16C3} ;J - ᛃ - j
return
laguz:
sendinput {U+16DA} ;L - ᛚ - l
return
mannaz:
sendinput {U+16D7} ;M - ᛗ - m
return
naudiz:
sendinput {U+16BE} ;N - ᚾ - n
input, UserInput, V L1 C,,
If (UserInput = "g") ;if ng go to ingwaz
{
send {backspace 2}
goto ingwaz
return
}
return
othila:
sendinput {U+16DF} ;O - ᛟ - o
return
perth:
sendinput {U+16C8} ;P - ᛈ - p
return
ingwaz:
sendinput {U+16DC} ;Q - ᛜ - ng (as in amo'ng' and seei'ng')
return
raido:
sendinput {U+16B1} ;R - ᚱ - r
return
sowilo:
send {backspace 1}
sendinput {U+16CA} ;S - ᛊ - s
return
tiwaz:
sendinput {U+16CF} ;T - ᛏ - t
input, UserInput, V L1 C,,
If (UserInput = "h") ;if th then go to thursaz
{
send {backspace 2}
goto thurisaz
return
}
If (UserInput = "s") ;if ts then go to algiz
{
send {backspace 2}
goto algiz
return
}
return
uruz:
sendinput {U+16A2} ;U - ᚢ - u
return
wunjo:
sendinput {U+16B9} ;W - ᚹ - w
return
thurisaz:
sendinput {U+16A6} ;X - ᚦ - th (as in 'th'e and bro'th')
return
ihwaz:
sendinput {U+16C7} ;Y - ᛇ - ï (unmodifiable 'eye')
return
algiz:
sendinput {U+16C9} ;Z - ᛉ - R ('-ts' as in ca'ts')
return
;================End=================
. The difference between the two FreeMono has all the characters in one font file. Where as Noto has them in separate individual fonts.
The only issue I've ran into is it may trip up if you mash the keyboard. It shouldn't during normal typing.
It's working about how I wanted it to. I may repost this into the Scripts and Functions board later. Gonna give it a few days to make sure there isn't any kinks I haven't ran into. Maybe after I figure out the slight issue when I tried to get "ck" detected and send as a single character, since both C and K are the same character as is. The method I was using for the other sequence detection wasn't working for some reason.
Beyond that, any tips on how clean it up would be nice, as I can be a bit of a messy scripter. So I'm not much in realizing on how to compact things.
Edit 2017-09-21: Reenabled Y, which was erronously disabled when posted. Also corrected S to the correct futhark rune.