nf67 Posted December 10, 2009 Share Posted December 10, 2009 Hi there ,Is there a way to send a character using its Unicode?Wikipedia states that U+0115 is the Unicode for ĕ , and ĕ is the "HTML Entity".I have no idea how to use either, as I have only used ASCII codes so far.Any help to Send ĕ ? Thanks a lot P.S: To send UNICODE characters enter the character code (decimal or hex), for example this sends a Chinese character Send("{ASC 2709}") or Send("{ASC 0xA95}")Tried Send("{ASC 0115}") but that failed, I don't see any other similarities that the example code and the codes I've found share . Link to comment Share on other sites More sharing options...
Developers Jos Posted December 10, 2009 Developers Share Posted December 10, 2009 try: Send(ChrW(0115)) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
nf67 Posted December 10, 2009 Author Share Posted December 10, 2009 (edited) try: Send(ChrW(0115))Odd, it outputs an S, maybe I am using the wrong kind of Unicode? Since trying a code with a letter in it (see the table below) gave me an error..(and just for clarity, my font does support the characters ) Edited December 10, 2009 by nf67 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 10, 2009 Developers Share Posted December 10, 2009 looks like you want Hex: 115 so try: ChrW(dec(0115)) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
nf67 Posted December 10, 2009 Author Share Posted December 10, 2009 (edited) looks like you want Hex: 115 so try: ChrW(dec(0115))Send(ChrW(014F)) gives me an errorSend(ChrW("014F")) gives me some other output, probably containing control (asks if I'd like to save my document)Send(ChrW(dec(014F))) gives me an error Send(ChrW(dec("014F"))) gives me the normal oNŎŎŏŏŏŏŏŏŏŏ! Leaves me clueless Edited December 10, 2009 by nf67 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 10, 2009 Developers Share Posted December 10, 2009 Does this give anything usefull: For $x = 1 to 800 ConsoleWrite( " $X=" & $x & " Hex=" & hex($x) & " chrw($x)=" & ChrW($x) & @CRLF) Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
nf67 Posted December 10, 2009 Author Share Posted December 10, 2009 Does this give anything usefull: For $x = 1 to 800 ConsoleWrite( " $X=" & $x & " Hex=" & hex($x) & " chrw($x)=" & ChrW($x) & @CRLF) Next Mm, the ŏ doesn't seem to be there. Then again, if you paste that character into scite it'll just give you a regular o (works fine in notepad). If the console font does this as well, then I might as well miss it, could be one of these: $X=332 Hex=0000014C chrw($x)=O $X=333 Hex=0000014D chrw($x)=o $X=334 Hex=0000014E chrw($x)=O $X=335 Hex=0000014F chrw($x)=o <= ŏ? $X=336 Hex=00000150 chrw($x)=O $X=337 Hex=00000151 chrw($x)=o Link to comment Share on other sites More sharing options...
nf67 Posted December 14, 2009 Author Share Posted December 14, 2009 Send(ChrW(Dec("0000014F"))) also returns the regular o ,could it be that autoit doesn't support these characters? Link to comment Share on other sites More sharing options...
jvanegmond Posted December 14, 2009 Share Posted December 14, 2009 (edited) To make a hexadecimal number in AutoIt you prefix it with 0x.. The dec function doesn't do anything in this matter. This worked for me: Send("{ASC 0x115}") My SciTE and Notepad both failed to recognize it, though. Edited December 14, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
nf67 Posted December 14, 2009 Author Share Posted December 14, 2009 To make a hexadecimal number in AutoIt you prefix it with 0x.. The dec function doesn't do anything in this matter.This worked for me:Send("{ASC 0x115}")My SciTE and Notepad both failed to recognize it, though.Mm yeah still the same result, while (as already mentioned above) Notepad and the font do support the character.. Link to comment Share on other sites More sharing options...
jvanegmond Posted December 14, 2009 Share Posted December 14, 2009 I can't even Alt + 0115 in notepad, so I doubt any code can do it. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Authenticity Posted December 14, 2009 Share Posted December 14, 2009 Change the encoding to UTF8 with BOM in SciTE (File -> Encoding -> UDF-8 with BOM) and try the next script:expandcollapse popupGlobal Const $KEYEVENTF_KEYUP =2 Global Const $KEYEVENTF_UNICODE = 4 Global Const $INPUT_KEYBOARD = 1 Global Const $iInputSize = 28 Global Const $tagKEYBDINPUT = _ 'ushort wVk;' & _ 'ushort wScan;' & _ 'dword dwFlags;' & _ 'dword time;' & _ 'ulong_ptr dwExtraInfo' Global Const $tagINPUT = _ 'dword type;' & _ $tagKEYBDINPUT & _ ';dword pad;' & _ 'dword pad;' Global $hDll = DllOpen('user32.dll') Global $sString = "ĕėĘęĚěĜĝĞğĠġĢģ" Run("notepad.exe") WinWaitActive('[CLASS:Notepad]') _SendEx($sString) DllClose($hDll) Exit Func _SendInputKB($iInputs, $pInputs, $iSize, $hDll = 'user32.dll') Local $aRet = DllCall($hDll, 'uint', 'SendInput', 'uint', $iInputs, 'ptr', $pInputs, 'int', $iSize) If @error Or Not $aRet[0] Then Return SetError(1, 0, False) Return SetError(0, 0, True) EndFunc Func _SendEx($sString) Local $tINPUTs, $pINPUTs, $iINPUTs Local $sStruct Local $iFlags, $iStrLen $iFlags = BitOR($KEYEVENTF_UNICODE, $KEYEVENTF_KEYUP) $iStrLen = StringLen($sString) $sStruct = '' For $i = 1 To $iStrLen * 2 $sStruct &= $tagINPUT Next $tINPUTs = DllStructCreate($sStruct) $pINPUTs = DllStructGetPtr($tINPUTs) $iINPUTs = $iStrLen * 2 For $i = 0 To $iStrLen-1 Local $Temp = AscW(StringMid($sString, $i+1, 1)) Local $iOffsetDown = $i * 8 Local $iOffsetUp = $i * 16 DllStructSetData($tINPUTs, $iOffsetDown+1, $INPUT_KEYBOARD) DllStructSetData($tINPUTs, $iOffsetDown+3, $Temp) DllStructSetData($tINPUTs, $iOffsetDown+4, $KEYEVENTF_UNICODE) DllStructSetData($tINPUTs, $iOffsetUp+9, $INPUT_KEYBOARD) DllStructSetData($tINPUTs, $iOffsetUp+11, $Temp) DllStructSetData($tINPUTs, $iOffsetUp+12, $iFlags) Next _SendInputKB($iINPUTs, $pINPUTs, $iInputSize, $hDll) EndFuncIf the encoding is not switched to UTF-8 with BOM right away. Create a new txt file, open with notepad and choose Save As and change the encoding using the dialog, save and rename the file as filename.au3 then open in SciTE. Link to comment Share on other sites More sharing options...
nf67 Posted December 15, 2009 Author Share Posted December 15, 2009 Change the encoding to UTF8 with BOM in SciTE (File -> Encoding -> UDF-8 with BOM) and try the next script:(...)If the encoding is not switched to UTF-8 with BOM right away. Create a new txt file, open with notepad and choose Save As and change the encoding using the dialog, save and rename the file as filename.au3 then open in SciTE.Thanks a lot, I'll try that tomorrow :-) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now