AutoHotkey Community

It is currently May 27th, 2012, 10:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 28th, 2010, 11:25 am 
Offline

Joined: February 16th, 2009, 9:45 pm
Posts: 2
Hey! This script is quite useful, but it wasn't working for codes that contained zeros. I've noticed that the Ctrl+Shift was only necessary while typing the "u" character. Also, the composition stops if the 4th hexadecimal character is a letter and the space character was inserted. The composition doesn't stop (and typing space is needed) when the 4th hexadecimal character is a digit. I've replaced typing space with another Shift keystroke and it works fine now. Here's the updated function:

Update: I noticed letters wouldn't get typed for the code, because Shift was up and the hexadecimals need to be uppercase. I updated the script so that only Ctrl gets released after U and Shift gets released at the end. Works like a charm.

Code:
SendUnicode( UniHex )
{
  ; difference between GTK+ applications and all other Windows applications
  IfWinActive ahk_class gdkWindowToplevel
    SendInput, {Ctrl down}{Shift down}u{Ctrl up}%UniHex%{Shift up}
  Else
    SendInput, {U+%UniHex%}
}


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 22nd, 2010, 11:54 pm 
Thanks a lot for this information. I took what the German site said and modified the code for spanish accented characters. Lacks the u with the double dot though.

Code:
CustomGTKSend(Text)
{
   ClipSaved := ClipboardAll
   clipboard := Text
   Send ^v
   Clipboard := ClipSaved
}

#IfWinActive ahk_class gdkWindowToplevel
!a::
CustomGTKSend("á")
return
!e::
CustomGTKSend("é")
return
!i::
CustomGTKSend("í")
return
!o::
CustomGTKSend("ó")
return
!u::
CustomGTKSend("ú")
return
!n::
CustomGTKSend("ñ")
return
!+a::
CustomGTKSend("Á")
return
!+e::
CustomGTKSend("É")
return
!+i::
CustomGTKSend("Í")
return
!+o::
CustomGTKSend("Ó")
return
!+u::
CustomGTKSend("Ú")
return
!+n::
CustomGTKSend("Ñ")
return
!1::
CustomGTKSend("¡")
return
!/::
CustomGTKSend("¿")
return
#IfWinActive


!a::SendInput {ASC 0225}   ;á
!e::SendInput {ASC 0233}   ;é
!i::SendInput {ASC 0237}   ;í
!o::SendInput {ASC 0243}   ;ó
!u::SendInput {ASC 0250}   ;ú
!n::SendInput {ASC 0241}   ;ñ
!+a::SendInput {ASC 0193}   ;Á
!+e::SendInput {ASC 0201}   ;É
!+i::SendInput {ASC 0205}   ;Í
!+o::SendInput {ASC 0211}   ;Ó
!+u::SendInput {ASC 0218}   ;Ú
!+n::SendInput {ASC 0209}   ;Ñ
!1::SendInput {ASC 0161}   ;¡
!/::SendInput {ASC 0191}   ;¿



ND wrote:
See this article (in german), in particular the "Update (2009-05-17)" section (contains link to a script).

P.S.
According AHK Help, section "General Remarks", the German umlauts can be sent by AHK on US / EU-Western code-page, but there are problems with other Unicode chars. For that reason I'm using Lexikos' [url]AutoHotkey_L[/url] custom build, and the script below:
Code:
$^!s::  SendUnicode( "0219" )  ; ș
$^!+s:: SendUnicode( "0218" )  ; Ș
$^!t::  SendUnicode( "021B" )  ; ț
$^!+t:: SendUnicode( "021A" )  ; Ț
; …

$!+Left::  SendUnicode( "2190" )  ; ←
$!+Up::    SendUnicode( "2191" )  ; ↑
$!+Right:: SendUnicode( "2192" )  ; →
$!+Down::  SendUnicode( "2193" )  ; ↓

$!+>:: SendUnicode( "2265" )  ; ≥
$!+<:: SendUnicode( "2264" )  ; ≤
; …

SendUnicode( UniHex )
{
  ; difference between GTK+ applications and all other Windows applications
  IfWinActive ahk_class gdkWindowToplevel
    SendInput, {Ctrl down}{Shift down}u%UniHex%{Space}{Shift up}{Ctrl up}
  Else
    SendInput, {U+%UniHex%}
}


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], chaosad, specter333, Yahoo [Bot] and 55 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group