Sign in to follow this  
Followers 0
Jon

Unicode / ALT Codes Thread

6 posts in this topic

Been doing some digging. I was under the impression that the AutoIt {ASC} syntax allowed the sending of all Unicode characters. But's that's incorrect.

All {ASC} does is send ALT followed by the numbers. e.g.

{ASC 0209} = {ALTDOWN}{NUMPAD0}{NUMPAD2}{NUMPAD0}{NUMPAD9}{ALTUP}

All ASC does is send an ALT code and an ALT code does not equal a Unicode "U+NNNN" code. I've found a few sites that list some ALT codes such as http://code.knopok.net/alt-codes.html

But, there appears to be a way to send proper U+NNNN unicode characters using the ALT key but this requires a special registry hack first:

HKEY_Current_User/Control Panel/Input Method/EnableHexNumpad = 1

(I don't know if there is a HKLM machine wide version).

Once this key is present (I believe it needs a logoff/logon before it works) then you can send U+NNNN codes as follows

ALT+NNNN

Note: The + actually means that you press the + key. So with the registry hack, to send U+2709 we need to do:

{ALTDOWN}{NUMPADADD}{NUMPAD2}{NUMPAD7}{NUMPAD0}{NUMPAD9}{ALTUP}

Some more stuff for future reference for me: http://www.fileformat.info/tip/microsoft/enter_unicode.htm

Share this post


Link to post
Share on other sites



Hmm, some applications though that use RichEdit controls (like Wordpad) do accept ALT+decimal code to give U+NNNN codes. So U+0A95 can be input using {ASC 2709}. But not in simple edit controls like notepad.

Share this post


Link to post
Share on other sites

Long story short, Send() is unreliable and you should use ControlSetText() or if you must use Send() then put data on the clipboard and Send() the paste command.

Share this post


Link to post
Share on other sites

I made it work by running it through ChrW() but I don't think that's the solution you're looking for.

Just modified from the Send() example

Send("#r")
WinWaitActive("Run")
Send("notepad.exe{Enter}")
WinWaitActive("Untitled -")
Send(ChrW(0209))
Exit

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

hi, i'm nam i'm from Vietnamese!

i have many problem with this!

i wanna create a program with my language but scite doesn't support.

with send() key i don't do this

Send("#r")
WinWaitActive("Run")
Send("notepad.exe{Enter}")
WinWaitActive("Untitled -")
Send(ChrW(0209))
Exit

and i do

$answer = MsgBox(4, "For Jun", "a gift for u! remember turn on Unikey and tick the Unicode check box + set vietnamese language!")


If $answer = 7 Then
    MsgBox(0, "For Jun", "Good bye
    Exit
Else
Run("notepad.exe")

WinWaitActive("Untitled - Notepad")


Send("!o")
Send("F")
Send("Times New Roman")
Send("{tab}")
Send("{tab}")
sleep(50)
Send("14")
Send("+{tab 2}")
Send("{enter}")
Sleep(500)
SEND("Chaof em .")
Sleep(200)
Send(".")
Sleep(200)
Send(".")
Sleep(500)
Send("{enter}")
Sleep(1500)
Send("Anh cos raats nhieeuf ddieeuf muoons nois voiws em!")
Sleep(2000)
; Now quit by pressing Alt-f and then x (File menu -> Exit)
Send("!f")
Send("x")
Send("n")

and in the notepad it will show:

Chào em...

Anh có rất nhiều điều muốn nói với em

i hope in new scite, it will support other language such as Vietnamese

Thanks for reading it!

Nam

Edit: "Anh cos raats nhieeuf ddieeuf muoons nois voiws em!" is the order of letter to show a meaning sentence in Vietnamese

Edited by LeHuynhNam

I'm Learner Of English so my words can have many mistake! I'll try my best to improve it

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0