Writing Norwegian with English keyboard layout Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Krutstugan
Posts: 22
Joined: 26 May 2021, 09:56

Writing Norwegian with English keyboard layout

Post by Krutstugan » 26 Oct 2021, 07:26

I want to use hotstrings to write Norwegian with an English keyboard (Rationale below). The Norwegian letters æ,ø and å are located on the same location at the following keys on a English keyboard layout: ' ; [

These letters always come after a consonant, so I have created hotstrings for each of these characters succeeding a consonant, for example:

Code: Select all

:?*:s'::sæ
:?*:t'::tæ
:?*:v'::væ
Some of these hotstrings would however, sometime interfere while writing English. Note for example that attempting to write "it's" with the above hotstring, produces "itæs". For this reason, I want to do one of the following:

1. Create hotstring of an hotstring:
::itæs::it's
2. Override the particular word of interest:
::it's::it's

The problem is that neither of these options worked.

Does anyone see any solution to my problem?

Rationale:
For a long time I have been switching the keyboard language layout back and forth depending on whether I write Norwegian or English. I prefer the English layout since many special characters are more easily accessible compared to Norwegian. Since I switch so many times during the day, I want a smoother solution.

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: Writing Norwegian with English keyboard layout

Post by mikeyww » 26 Oct 2021, 08:15

Code: Select all

~t::
prior := A_PriorKey
Input, key, L1T3
Send % key != "'" || prior = "i" ? key : "æ"
Return
It isn't perfect but might help.

Rohwedder
Posts: 7551
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Writing Norwegian with English keyboard layout  Topic is solved

Post by Rohwedder » 26 Oct 2021, 11:25

Hallo,
or:

Code: Select all

:*:itæs::it's
#InputLevel 1
:?*X:s'::Send sæ
:?*X:t'::Send tæ
:?*X:v'::Send væ
#InputLevel 0
or:

Code: Select all

:*:itæs::it's
#InputLevel 1
:?*X:s'::
:?*X:t'::
:?*X:v'::SendInput,% SubStr(A_ThisHotkey,6,1) "æ"
#InputLevel 0
Highlevel Execute Hotstrings trigger LowLevel Hotstrings

User avatar
Krutstugan
Posts: 22
Joined: 26 May 2021, 09:56

Re: Writing Norwegian with English keyboard layout

Post by Krutstugan » 27 Oct 2021, 06:01

Many thanks for both suggestions! Really helpful :)

I have included the entire script below. It's probably not 100% yet, but so far it seems to serve me pretty well.
So far, the only identified scenario I could not make work is if somebody wanted to use upper case Ø (: character on English keyboard layout) after a lower case consonant. Didn't care to look further into it as this would be a very rare scenario. Important thing is that upper case Ø before a consonant works fine.

Code: Select all

; Write æ,ø,å with English keyboard
; * means no end character (space) is required. 
; ? means it can be inside another word
; X means Execute. Instead of replacement text, the hotstring accepts a command or expression to execute.
; Documentation: https://www.autohotkey.com/docs/Hotstrings.htm


#IfWinNotActive, ahk_group exclusionListNorwegianCharacters ; Exclude ceratin applications. See autosection of main section for list definition.
*/
; ************ Exceptions ************
:?*:Iæm::I'm ; Exception for contractions like it's 
:?*:tæs::t's ; Exception for contractions like it's 
:?*:næt::n't ; Exception for contractions like don't, won't, can't
:?*:eæs::e's ; Exception for contractions like here's, he's, she's 
:?*:ræs::r's ; Exception for contractions like her's, mother's 
:?*:uær::u'r ; Exception for you're 
; ************************************ 

; Stand alone å:
:?*o:[ ::å{space}
:?*o:{ ::Å{space}

#InputLevel 1
;*******************************
;**************Æ****************
;*******************************
	;*********UPPER CASE************
		;*****Succeeding Æ*******
			:?*X:"b::Send Æb
			:?*X:"d::Send Æd
			:?*X:"f::Send Æf
			:?*X:"g::Send Æg
			:?*X:"h::Send Æh
			:?*X:"j::Send Æj
			:?*X:"k::Send Æk
			:?*X:"l::Send Æl
			:?*X:"m::Send Æm
			:?*X:"n::Send Æn
			:?*X:"p::Send Æp
			:?*X:"r::Send Ær
			:?*X:"s::Send Æs
			:?*X:"t::Send Æt
			:?*X:"v::Send Æv
		;*****Preceding æ******* 
			:?*X:B'::Send Bæ
			:?*X:D'::Send Dæ
			:?*X:F'::Send Fæ
			:?*X:G'::Send Gæ
			:?*X:H'::Send Hæ
			:?*X:J'::Send Jæ
			:?*X:K'::Send Kæ
			:?*X:L'::Send Læ
			:?*X:M'::Send Mæ
			:?*X:N'::Send Næ
			:?*X:P'::Send Pæ
			:?*X:R'::Send Ræ 
			:?*X:S'::Send Sæ
			:?*X:T'::Send Tæ
			:?*X:V'::Send Væ
		;*****Æ succeeding a consonant*******
		;	:?*X:b"::Send bÆ
		;	:?*X:d"::Send dÆ
		;	:?*X:f"::Send fÆ
		;	:?*X:g"::Send gÆ
		;	:?*X:h"::Send hÆ
		;	:?*X:j"::Send jÆ
		;	:?*X:k"::Send kÆ
		;	:?*X:l"::Send lÆ
		;	:?*X:m"::Send mÆ
		;	:?*X:n"::Send nÆ
		;	:?*X:p"::Send pÆ
		;	:?*X:r"::Send rÆ
		;	:?*X:s"::Send sÆ
		;	:?*X:t"::Send tÆ
		;	:?*X:v"::Send vÆ
	;*********lower case************
		;*****Preceding a consonant*******
			:?*X:'b::Send æb
			:?*X:'d::Send æd
			:?*X:'f::Send æf
			:?*X:'g::Send æg
			:?*X:'h::Send æh
			:?*X:'j::Send æj
			:?*X:'k::Send æk
			:?*X:'l::Send æl
			:?*X:'m::Send æm
			:?*X:'n::Send æn
			:?*X:'p::Send æp
			:?*X:'r::Send ær
			:?*X:'s::Send æs
			:?*X:'t::Send æt
			:?*X:'v::Send æv
		;*****Suceeding a consonant*******
			:?*X:b'::Send bæ
			:?*X:d'::Send dæ
			:?*X:f'::Send fæ
			:?*X:g'::Send gæ
			:?*X:h'::Send hæ
			:?*X:j'::Send jæ
			:?*X:k'::Send kæ
			:?*X:l'::Send læ
			:?*X:m'::Send mæ
			:?*X:n'::Send næ
			:?*X:p'::Send pæ
			:?*X:r'::Send ræ
			:?*X:s'::Send sæ
			:?*X:t'::Send tæ
			:?*X:v'::Send væ
;*******************************
;**************Ø****************
;*******************************
	;*********UPPER CASE************
		;*****Suceeding Ø*******
			:?*X::b::Send Øb
			:?*X::d::Send Ød
			:?*X::f::Send Øf
			:?*X::g::Send Øg
			:?*X::h::Send Øh
			:?*X::j::Send Øj
			:?*X::k::Send Øk
			:?*X::l::Send Øl
			:?*X::m::Send Øm
			:?*X::n::Send Øn
			:?*X::p::Send Øp
			:?*X::r::Send Ør
			:?*X::s::Send Øs
			:?*X::t::Send Øt
			:?*X::v::Send Øv
		;*****Preceding ø*******
			:?*X:B;::Send Bø
			:?*X:D;::Send Dø
			:?*X:F;::Send Fø
			:?*X:G;::Send Gø
			:?*X:H;::Send Hø
			:?*X:J;::Send Jø
			:?*X:K;::Send Kø
			:?*X:L;::Send Lø
			:?*X:M;::Send Mø
			:?*X:N;::Send Nø
			:?*X:P;::Send Pø
			:?*X:R;::Send Rø 
			:?*X:S;::Send Sø
			:?*X:T;::Send Tø
			:?*X:V;::Send Vø
		;****Capital Ø suceeding a consonant******* Does not work: https://www.autohotkey.com/board/topic/5871-hotstrings-with-colon/
		;	:?*X:b:::Send bØ
		;	:?*X:d:::Send dØ
		;	:?*X:f:::Send fØ
		;	:?*X:g:::Send gØ
		;	:?*X:h:::Send hØ
		;	:?*X:j:::Send jØ
		;	:?*X:k:::Send kØ
		;	:?*X:l:::Send lØ
		;	:?*X:m:::Send mØ
		;	:?*X:n:::Send nØ
		;	:?*X:p:::Send pØ
		;	:?*X:r:::Send rØ
		;	:?*X:s:::Send sØ
		;	:?*X:t:::Send tØ
		;	:?*X:v:::Send vØ
	;*********lower case************
		;*****Preceding a consonant*******
			:?*X:;b::Send øb
			:?*X:;d::Send ød
			:?*X:;f::Send øf
			:?*X:;g::Send øg
			:?*X:;h::Send øh
			:?*X:;j::Send øj
			:?*X:;k::Send øk
			:?*X:;l::Send øl
			:?*X:;m::Send øm
			:?*X:;n::Send øn
			:?*X:;p::Send øp
			:?*X:;r::Send ør
			:?*X:;s::Send øs
			:?*X:;t::Send øt
			:?*X:;v::Send øv
		;*****Suceeding a consonant*******
			:?*X:b;::Send bø
			:?*X:d;::Send dø
			:?*X:f;::Send fø
			:?*X:g;::Send gø
			:?*X:h;::Send hø
			:?*X:j;::Send jø
			:?*X:k;::Send kø
			:?*X:l;::Send lø
			:?*X:m;::Send mø
			:?*X:n;::Send nø
			:?*X:p;::Send pø
			:?*X:r;::Send rø
			:?*X:s;::Send sø
			:?*X:t;::Send tø
			:?*X:v;::Send vø
;*******************************
;**************Å****************
;*******************************
	;*********UPPER CASE************
		;*****Succeeding å*******
			:?*X:{b::Send Åb
			:?*X:{d::Send Åd
			:?*X:{f::Send Åf
			:?*X:{g::Send Åg
			:?*X:{h::Send Åh
			:?*X:{j::Send Åj
			:?*X:{k::Send Åk
			:?*X:{l::Send Ål
			:?*X:{m::Send Åm
			:?*X:{n::Send Ån
			:?*X:{p::Send Åp
			:?*X:{r::Send År 
			:?*X:{s::Send Ås
			:?*X:{t::Send Åt
			:?*X:{v::Send Åv
		;*****Preceding å******* 
			:?*X:B[::Send Bå
			:?*X:D[::Send Då
			:?*X:F[::Send Få
			:?*X:G[::Send Gå
			:?*X:H[::Send Hå
			:?*X:J[::Send Jå
			:?*X:K[::Send Kå
			:?*X:L[::Send Lå
			:?*X:M[::Send Må
			:?*X:N[::Send Nå
			:?*X:P[::Send På
			:?*X:R[::Send Rå 
			:?*X:S[::Send Så
			:?*X:T[::Send Tå
			:?*X:V[::Send Vå
	;*********lower case************
		;*****Preceding a consonant*******
			:?*X:[b::Send åb
			:?*X:[d::Send åd
			:?*X:[f::Send åf
			:?*X:[g::Send åg
			:?*X:[h::Send åh
			:?*X:[j::Send åj
			:?*X:[k::Send åk
			:?*X:[l::Send ål
			:?*X:[m::Send åm
			:?*X:[n::Send ån
			:?*X:[p::Send åp
			:?*X:[r::Send år 
			:?*X:[s::Send ås
			:?*X:[t::Send åt
			:?*X:[v::Send åv
		;*****Suceeding a consonant*******
			:?*X:b[::Send bå
			:?*X:d[::Send då
			:?*X:f[::Send få
			:?*X:g[::Send gå
			:?*X:h[::Send hå
			:?*X:j[::Send jå
			:?*X:k[::Send kå
			:?*X:l[::Send lå
			:?*X:m[::Send må
			:?*X:n[::Send nå
			:?*X:p[::Send på
			:?*X:r[::Send rå 
			:?*X:s[::Send så
			:?*X:t[::Send tå
			:?*X:v[::Send vå
#InputLevel 0
#IfWinNotActive
Return

Post Reply

Return to “Ask for Help (v1)”