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 

Accent Hotkey Script

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





PostPosted: Tue Aug 03, 2004 8:25 am    Post subject: Accent Hotkey Script Reply with quote

I'm not sure if a script like this has already been posted. I just noticed the umlaut script, but that is not really quite the same thing. Anyway, this is a relatively simple script that adds Word-style hotkeys for accents and a few other things using the windows key and keys that look vaguely like accent marks for the shortcuts (I find the windows key rarely is used for other hotkeys, so there's no problem with disabling something I want in some program). What I mean by word-style hotkeys are ones where you hit a hotkey for an accent type, such as acute, then the next key, be it e, a, i or whatever that takes an acute accent will have one. This script accomplishes this by having hotkeys for a, e, i, o, u, c and n, which are disabled most of the time. Hitting any of the accent hotkeys enables them and and sets a variable to the desired type of accent.
I hope this is helpful to people. I also have a few other common character hotkeys with the Win key in the beginning, feel free to take just use whatever bits of the code you want, and/or add characters and accents.

Code:

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT or later
; Author:         Ethan
;


#+-::Send,—
#-::Send,–

#+[::Send,“
#+]::Send,”

#[::Send,‘
#]::Send,’

#o::Send,°
#c::Send,©
#t::Send,™
#.::Send,…

a::
if accent=acute
   Send,á
else if accent=grave
   Send,à
else if accent=circumflex
   Send,â
else if accent=umlaut
   Send,ä
else if accent=tilda
    Send,ã
Gosub,TurnAccentsOff
Return

e::
if accent=acute
   Send,é
else if accent=grave
   Send,è
else if accent=circumflex
   Send,ê
else if accent=umlaut
   Send,ë
Gosub,TurnAccentsOff
Return

i::
if accent=acute
   Send,í
else if accent=grave
   Send,ì
else if accent=circumflex
   Send,î
else if accent=umlaut
   Send,ï
Gosub,TurnAccentsOff
Return

o::
if accent=acute
   Send,ó
else if accent=grave
   Send,ò
else if accent=circumflex
   Send,ô
else if accent=umlaut
   Send,ö
else if accent=tilda
    Send,õ
Gosub,TurnAccentsOff
Return

u::
if accent=acute
   Send,ú
else if accent=grave
   Send,ù
else if accent=circumflex
   Send,û
else if accent=umlaut
   Send,ü
Gosub,TurnAccentsOff
Return

c::
if accent=cedilla
    Send,ç
Gosub,TurnAccentsOff
Return

n::
if accent=tilda
    Send,ñ
Gosub,TurnAccentsOff
Return

+a::
if accent=acute
   Send,Á
else if accent=grave
   Send,À
else if accent=circumflex
   Send,Â
else if accent=umlaut
   Send,Ä
else if accent=tilda
    Send,Ã
Gosub,TurnAccentsOff
Return

+e::
if accent=acute
   Send,É
else if accent=grave
   Send,È
else if accent=circumflex
   Send,Ê
else if accent=umlaut
   Send,Ë
Gosub,TurnAccentsOff
Return

+i::
if accent=acute
   Send,Í
else if accent=grave
   Send,Ì
else if accent=circumflex
   Send,Î
else if accent=umlaut
   Send,Ï
Gosub,TurnAccentsOff
Return

+o::
if accent=acute
   Send,Ó
else if accent=grave
   Send,Ò
else if accent=circumflex
   Send,Ô
else if accent=umlaut
   Send,Ö
else if accent=tilda
    Send,Õ
Gosub,TurnAccentsOff
Return

+u::
if accent=acute
   Send,ú
else if accent=grave
   Send,ù
else if accent=circumflex
   Send,û
else if accent=umlaut
   Send,ü
Gosub,TurnAccentsOff
Return

+c::
if accent=cedilla
    Send,Ç
Gosub,TurnAccentsOff
Return

+n::
if accent=tilda
    Send,Ñ
Gosub,TurnAccentsOff
Return

TurnAccentsOff:
Hotkey,a,off
Hotkey,e,off
Hotkey,i,off
Hotkey,o,off
Hotkey,u,off
Hotkey,c,off
Hotkey,n,off
Hotkey,+a,off
Hotkey,+e,off
Hotkey,+i,off
Hotkey,+o,off
Hotkey,+u,off
Hotkey,+c,off
Hotkey,+n,off
Return

TurnAccentsOn:
Hotkey,a,on
Hotkey,e,on
Hotkey,i,on
Hotkey,o,on
Hotkey,u,on
Hotkey,c,on
Hotkey,n,on
Hotkey,+a,on
Hotkey,+e,on
Hotkey,+i,on
Hotkey,+o,on
Hotkey,+u,on
Hotkey,+c,on
Hotkey,+n,on
Return

#'::
accent=acute
Gosub,TurnAccentsOn
Return

#`::
accent=grave
Gosub,TurnAccentsOn
Return

#6::
#+6::
accent=circumflex
Gosub,TurnAccentsOn
Return

#;::
#+;::
accent=umlaut
Gosub,TurnAccentsOn
Return

#,::
accent=cedilla
Gosub,TurnAccentsOn
Return

#+`::
accent=tilda
Gosub,TurnAccentsOn
Return

Gosub,TurnAccentsOff
Back to top
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