Page 1 of 1

Send ñ or Ñ

Posted: 26 Nov 2021, 21:26
by chiropterist
I have read many messages in this forum about codes for accented characters, but all of them are attempting something complicated and I cannot figure out which part of the code does what.

I want to do one simple thing:
When typing into a website or LibreOffice, I want to press 'n or 'N and see ñ or Ñ

Here is my attempt at coding this:

Code: Select all

'&n::Send ñ
'&N::Send Ñ
Result: ñ' or Ñ'. My attempt at coding this almost works, except for the trailing '.
Could someone please help me figure out how to remove the trailing '. My brain is about to explode.

Thanks,
Old enough to be your great-grandparent

Re: ñ'Ñ'

Posted: 26 Nov 2021, 21:59
by HotKeyIt

Code: Select all

' & n::Send % getkeystate("Shift","P") ? "Ñ" : "ñ"

Re: ñ'Ñ'

Posted: 27 Nov 2021, 09:19
by Delta Pythagorean
I don't know what this post is implying... I would guess you meant to post a reply to another thread and it didn't work?

Re: ñ'Ñ'

Posted: 27 Nov 2021, 09:27
by gregster
Delta Pythagorean wrote:
27 Nov 2021, 09:19
I don't know what this post is implying... I would guess you meant to post a reply to another thread and it didn't work?
It's all good. The original post disappeared because it was edited and needed to be re-approved.

Re: ñ'Ñ'

Posted: 27 Nov 2021, 14:29
by chiropterist

Code: Select all

'&n::Send ñ
'&N::Send Ñ
Thank you, HotKeyIt

Now I can type ñ and Ñ using my shortcut (most of the time). BUT...I can no longer type an apostrophe by itself.
What am I missing? This is far above my pay grade.

Thanks for your ongoing help
Old enough to be your great-grandparent

Re: ñ'Ñ'

Posted: 27 Nov 2021, 19:38
by chiropterist

Code: Select all

'&n::Send ñ
'&N::Send Ñ
It seems to me that some sort of an if-then-else type of statement is in order here (I'll be that dates me!).
Could somebody please show me how to do that?

When I get this working I promise to sing your praises and not bother you for quite some time.

Thanks again,
Old enough to be your great-grandparent

Re: ñ'Ñ'

Posted: 27 Nov 2021, 19:56
by dd900
try

Code: Select all

'&n::Send ñ
'&N::Send Ñ
`::Send {`}
or

Code: Select all

~'&n::Send ñ
~'&N::Send Ñ
https://www.autohotkey.com/docs/Hotkeys.htm#combo
https://www.autohotkey.com/docs/Hotkeys.htm#Symbols