AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Yet another accent / special character script

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Fri Feb 29, 2008 12:10 am    Post subject: Yet another accent / special character script Reply with quote

This is inspired by how MS Word does it. You press Ctrl and a key representing the accent symbol (`'^:~@,&/-$) then a litter. But I expanded it a little. The Ctrl+` modifier can be combined with several other keys to make various symbols, as can a few others. For instance Ctrl+/, previous only used for Ø also does ¼, ½ and ¾. Finally I added Ctrl+$ for currency symbols.

Code:
#SingleInstance Force
#NoEnv
SendMode Input
;--------------------

CharList =
( LTrim ` %
`aàeèiìoòuùAÀEÈIÌOÒUÙ?¿?¡'‘"“c©r®t™2²3³0°*•x×/÷%‰.…+†|‡s§p¶mµ
'aáeéiíoóuúyýAÁEÉIÍOÓUÚYÝ'’"”
^aâeêiîoôuûsšzžAÂEÊIÎOÔUÛSŠZŽ
:aäeëiïoöuüyÿAÄEËIÏOÖUÜYŸ
~aãnñoõAÃNÑOÕ
@aåAÅ
,cçCÇ
/oøOØ4¼2½3¾
&aæoœsßAÆOŒ
-tþdðTÞDÐn–m—+±
$c¢l£p£y¥e€*¤fƒ
)

AccentChars := "``'^:~@,/&-$"
Loop Parse, AccentChars
   HotKey ^%A_LoopField%, Accent

Accent:
Accent := SubStr(A_ThisHotkey, 0, 1)
SetTimer HandleAccent, -1
Return

HandleAccent:
Input BaseChar, L1VM
If (Asc(BaseChar) < 32)
   Return
Found := RegExMatch(CharList, "`am)^\Q" . Accent . "\E\S*\Q" . BaseChar . "\E(.)", Match)]
If Found
   Send {BS}%Match1%
Return


Here's the full list:
Code:
Ctrl+` (Grave Accent, Left Quotes and Misc)
aeiouAEIOU??'"crt230*x/%.+|spm
àèìòùÀÈÌÒÙ¿¡‘“©®™²³°•×÷‰…†‡§¶µ

Ctrl+' (Acute Accent and Right Quotes)
aeiouyAEIOUY'"
áéíóúýÁÉÍÓÚÝ’”

Ctrl+^ (Circumflex or Caron)
aeiouszAEIOUSZ
âêîôûšžÂÊÎÔÛŠŽ

Ctrl+: (Diaeresis)
aeiouyAEIOUY
äëïöüÿÄËÏÖÜŸ

Ctrl+~ (Tilde)
anoANO
ãñõÃÑÕ

Ctrl+@ (Å)
aA
åÅ

Ctrl+, (Ç)
cC
çÇ

Ctrl+/ (Ø and Fractions)
oO423
øØ¼½¾

Ctrl+& (Ligatures)
aosAO
æœßÆŒ

Ctrl+- (Thorn, Eth, Dashs and ±)
tdTDnm+
þðÞЖ—±

Ctrl+$ (Currency)
clpye*f
¢££¥€¤ƒ
Back to top
View user's profile Send private message
afromonkey0



Joined: 13 Oct 2007
Posts: 24

PostPosted: Sat Mar 01, 2008 12:24 pm    Post subject: Nice Reply with quote

That's a pretty neat implementation of an old idea. Nice and upgradable, and not many lines of code.
I use google docs now and i've been missing word's unicode characters, this works great. (I'm trying to add all of word's functionality to gdocs using AHK. could be here for a while Confused )
I think i'll add in greek characters, i need them for physics notes.
Back to top
View user's profile Send private message
afromonkey0



Joined: 13 Oct 2007
Posts: 24

PostPosted: Sat Mar 01, 2008 12:48 pm    Post subject: Reply with quote

Well that didn't work.
Seems autohotkey can only read ANSI encoded scripts, and most greek letters are unicode. Mad
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sat Mar 01, 2008 3:39 pm    Post subject: Reply with quote

You can use Unicode in AHK, just search the Forum. E.g. you can select them, copy to Clipboard, transform to UTF-8, process and send back Unicode (see one example here).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group