 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Henrique
Joined: 13 Jul 2006 Posts: 4
|
Posted: Thu Sep 21, 2006 10:53 pm Post subject: Internal way to Transform Unicode |
|
|
Hello all,
I've created a huge AHK script which enables me to type any accented and/or special character other than the few ones already available on my keyboard.
It's a script full of lines like these:
| Code: |
;Caron, diaeresis and caron
:c*?:<a::{ASC 462}
:c*?:<A::{ASC 461}
:c*?:<c::{ASC 269}
:c*?:<C::{ASC 268}
:c*?:<d::{ASC 271}
:c*?:<D::{ASC 270}
:c*?:<e::{ASC 283}
:c*?:<E::{ASC 282}
:c*?:<g::{ASC 487}
:c*?:<G::{ASC 486}
:c*?:<h::{ASC 543}
:c*?:<H::{ASC 542}
:c*?:<i::{ASC 464}
:c*?:<I::{ASC 463}
:*?:<j::{ASC 496}
:c*?:<k::{ASC 489}
:c*?:<K::{ASC 488}
:c*?:<l::{ASC 318}
:c*?:<L::{ASC 317}
:c*?:<n::{ASC 328}
:c*?:<N::{ASC 327}
:c*?:<o::{ASC 466}
:c*?:<O::{ASC 465}
:c*?:<r::{ASC 345}
:c*?:<R::{ASC 344}
:c*?:<s::{ASC 353}
:c*?:<S::{ASC 352}
:c*?:<t::{ASC 357}
:c*?:<T::{ASC 356}
:c*?:<u::{ASC 468}
:c*?:<U::{ASC 467}
:c*?:<ü::{BS 1}{ASC 474} ;u
:c*?:<Ü::{BS 1}{ASC 473} ;U
:c*?:<x::{ASC 495} ;ezh
:c*?:<X::{ASC 494} ;EZH
:c*?:<z::{ASC 382}
:c*?:<Z::{ASC 381}
|
...And that's for the caron-accented letters alone. All other characters available on Unicode, like ę, ş, ă, etc. are available on the script.
My idea was to post this universal script here, so that anyone could type on any language (written with the latin alphabet), regardless of characters available on his keyboard; I have only used regular ASCII characters to create the combinations, as in the "<" example above. (I realize that I should perform some modifications here and there, like trading <Ü for, let's say, <"U . That's easy to do.)
However - and AutoHotkey's help file warns me about that - using {ASC xxx} might not work under some applications. Through experience I saw that it does not work under *many* of them. It works, for instance, on Opera and Windows Live Messenger, but not on Outlook Express, Mozilla Thunderbird and many others. A better way would be to use "Transform Unicode".
Well, I'm talking about more than 300 lines like the ones above. My suggestion is, if possible, to cause AutoHotkey to "internally" use the "Transform Unicode" feature when it reads {ASC xxx} in a script (when xxx>255) instead of forcing me to recode the whole script.
Thanks,
Henrique |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4065 Location: Pittsburgh
|
Posted: Thu Sep 21, 2006 11:36 pm Post subject: |
|
|
We discussed these many times in the forum. There will be eventually a Unicode version of AHK, but until then you have to work around this limitation. An automatic transform to Unicode would put the character in the clipboard, then you need to paste it. It could be annoying when your clipboard is destroyed, saving and restoring it slows down the script.
Shimanov has found a solution for XP (and possibly other Windows versions). It needs multi-line hotstrings, though. | Code: | DllCall("LoadLibrary", Str,"ntdll.dll")
VarSetCapacity( SendUbuf, 56, 0 ) ; INIT SendU data strucure
DllCall("RtlFillMemory", UInt,&SendUbuf, UInt,1, UInt,1)
DllCall("RtlFillMemory", UInt,&SendUbuf+28, UInt,1, UInt,1)
:c*?:<a::
SendU(462)
Return
:c*?:<A::
SendU(461)
Return
:c*?:<c::
SendU(269)
Return
:c*?:<C::
SendU(268)
Return
:c*?:<d::
SendU(271)
Return
:c*?:<D::
SendU(270)
Return
:c*?:<e::
SendU(283)
Return
:c*?:<E::
SendU(282)
Return
:c*?:<g::
SendU(487)
Return
:c*?:<G::
SendU(486)
Return
;...
SendU(UC) { ; Send Char/Unicode, Pressed modifier keys stay active!
Global ; SendU(0x00E1) or SendU(33)
DllCall("ntdll.dll\RtlFillMemoryUlong",UInt,&SendUbuf+6, UInt,4,UInt,0x40000|UC) ;KEYEVENTF_UNICODE
DllCall("ntdll.dll\RtlFillMemoryUlong",UInt,&SendUbuf+34,UInt,4,UInt,0x60000|UC) ;KEYEVENTF_KEYUP|^
Return DllCall("SendInput", UInt,2, UInt,&SendUbuf, Int,28)
} |
|
|
| Back to top |
|
 |
vbanait Guest
|
Posted: Wed Oct 18, 2006 5:42 am Post subject: Didnot understand |
|
|
I did not understand how these scripts work
vaibhav |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4065 Location: Pittsburgh
|
Posted: Wed Oct 18, 2006 3:27 pm Post subject: |
|
|
| ...and now you do? If you still don't understand, which part is it? The hotstrings or the dll calls? For the later ones go to the MSDN website, you have to go through all the intro to character input. |
|
| Back to top |
|
 |
Lester Wong Guest
|
Posted: Thu May 03, 2007 8:54 am Post subject: |
|
|
| Can anyone please tell me why this works everywhere except Skype? |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3644 Location: Belgrade
|
Posted: Sat May 05, 2007 1:45 pm Post subject: |
|
|
Maybe you should ask Skype developers  _________________
 |
|
| Back to top |
|
 |
Roussi Nikolov Guest
|
Posted: Mon May 14, 2007 8:20 am Post subject: |
|
|
| Quote: | | AutoIt is now compiled for Unicode |
Really great advance!
| Quote: | | There will be eventually a Unicode version of AHK... |
Can you tell me, please, what "eventually" means more specifically.
| Quote: | | but until then you have to work around this limitation |
Is there a workaround to display Unicode characters in ToolTips ? |
|
| Back to top |
|
 |
John W
Joined: 09 Apr 2007 Posts: 174
|
Posted: Mon May 14, 2007 12:15 pm Post subject: |
|
|
This makes it for every character in a string:
| Code: | Ascii=
InputBox, TextToConvert, CharScii, Insert string here, , 200, 100,,,,,
Pos=1
Loop, % StrLen(TextToConvert)
{
TextPart := % SubStr(TextToConvert, Pos, 1)
Pos++
Add := % Asc(TextPart)
Ascii := % Ascii Add
}
MsgBox %Ascii% |
_________________ John
Inactive - Until AutoHotkey is available for Linux.
 |
|
| Back to top |
|
 |
Grumpy Guest
|
Posted: Mon May 14, 2007 1:08 pm Post subject: |
|
|
I strongly doubt it will work...
Actually, I don't even know what you are trying to show, as you don't use ToolTip...
Perhaps a DllCall to SendMessageW to the tooltip might work. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|