Sign in to follow this  
Followers 0
giovanigonzales

Send Unicode problem

7 posts in this topic

Can not send unicode characters. For example I tried to send this Cyrillic character - Ц (unicode D0A6)

Seems Send ASC completely ignores the first byte, and simply sends only the second - A6

HotKeySet("!t", "MyFunc")

While 1

Sleep(100)

WEnd

Func MyFunc()

Send("{ASC 0xD0A6}")

Send("{ASC 0xA6}")

Send("{ASC 0x1A6}")

Send("{ASC 0x2A6}")

Send("{ASC 0x3A6}")

Send("{ASC 0x4A6}")

EndFunc

All Sends the same character 0xA6 - "¦"

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

A quick and dirty solution might be to type the character into a notepad window and save the file. Then use this:

$vietnameseChar = FileRead("file.txt")

The Char() function only works for ASCII characters.

If that doesn't work, try saving file.txt with «Unicode» encoding.

This link has something about the topic.

Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

http://www.autoitscript.com/autoit3/docs/intro/unicode.htm

Current Limitations

There are a few parts of AutoIt that don't yet have full Unicode support. These are:

* Send and ControlSend - Instead, Use ControlSetText or the Clipboard functions.

* Regular expressions - To reduce the size of AutoIt, the regular expression engine is currently compiled in ANSI mode.

* Console operations are converted to ANSI.

These limits will be addressed in future versions if possible.

Share this post


Link to post
Share on other sites

Thanks

I have way too little experience in Autoit3, can you show me how to send an Unicode char using ControlSetText please?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks

I have way too little experience in Autoit3, can you show me how to send an Unicode char using ControlSetText please?

Once you have successfully created file.txt which contains the single character that you want at the top, no carriage returns in it, you would try the code below, and if it won't, maybe someone else has an idea.

You need to use the Window Info tool found at

Start button > All Programs > AutoIt v3 > AutoIt Window Info

And with the target window open as well, find the right values for the titlebar text, and the target control's real ClassnameNN, and use those values in this code:

Opt("WinTitleMatchMode", 4)
$squirrely_character = FileRead("file.txt")
Sleep(300);wait a moment to give function time to execute
ControlSetText("titlebar text goes here", "", "[ClassnameNN:the real classnameNN of the control goes here]", $squirrely_character)
Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Thanks, but I found a way that I find more simple, using Clipboard functions:

HotKeySet("^!u", "MyFunc")

Func MyFunc()

ClipPut("Ц")

Send("^v")

EndFunc

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Victory ! :)

Edited by Squirrely1

Das Häschen benutzt Radar

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