waleed Posted August 2, 2009 Posted August 2, 2009 (edited) Hello, First, thank you for this great programme. It rally is very useful! My question is this:- In a log-in situation where the username is in Arabic, the string appears 'garbaged', not the intended characters. For example: Send ("وليد") // that is "waleed" in Arabic would print æáíÏ in the log-in field I have considered and tried different ways without success, e.g. StringToASCIIArray, StringFromASCIIArray, Send("{ASC value}"). Is there a way to do it? Thank you Waleed Edited August 2, 2009 by waleed
Info Posted August 2, 2009 Posted August 2, 2009 (edited) Hebrew arrays work well in my AutoIt programs. >_ Edited August 2, 2009 by Info
DCCD Posted August 2, 2009 Posted August 2, 2009 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. Console operations are converted to ANSI. These limits will be addressed in future versions if possible. . [u][font=Arial Black]M[/font]y Blog, AVSS Parts[/u][font=Arial Black]Else[/font][font=Arial Black]L[/font]ibya Linux Users Group
waleed Posted August 2, 2009 Author Posted August 2, 2009 Thank you very much for your response. Best regards, Waleed
Authenticity Posted August 2, 2009 Posted August 2, 2009 (edited) Taken from another thread but posted here because the code tags was corrupted:expandcollapse popupGlobal Const $KEYEVENTF_KEYUP =2 Global Const $KEYEVENTF_UNICODE = 4 Global Const $INPUT_KEYBOARD = 1 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 = "وليد " Global $sTemp = ClipGet() Run('notepad.exe') WinWaitActive('[CLASS:Notepad]') _SendEx($sString) ClipPut($sString) Send('^v') ClipPut($sTemp) 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 $tINPUT, $pINPUT, $iINPUT Local $iFlags, $iStrLen $iFlags = BitOR($KEYEVENTF_UNICODE, $KEYEVENTF_KEYUP) $iStrLen = StringLen($sString) $tINPUT = DllStructCreate($tagINPUT) $pINPUT = DllStructGetPtr($tINPUT) $iINPUT = DllStructGetSize($tINPUT) DllStructSetData($tINPUT, 'type', $INPUT_KEYBOARD) DllStructSetData($tINPUT, 'wVk', 0) For $i = 1 To $iStrLen DllStructSetData($tINPUT, 'dwFlags', $KEYEVENTF_UNICODE) DllStructSetData($tINPUT, 'wScan', AscW(StringMid($sString, $i, 1))) _SendInputKB(1, $pINPUT, $iINPUT, $hDll) DllStructSetData($tINPUT, 'dwFlags', $iFlags) _SendInputKB(1, $pINPUT, $iINPUT, $hDll) Next EndFuncWhen SciTE is configured to support encoding of UTF-8 with BOM everything is smooth.You may drop all this and use ClipPut() and ClipGet() as it's much faster and involve no great overhead like _SendEx() involves.Edit: ..Nevermind. The modified code: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) EndFunc Edited August 2, 2009 by Authenticity
waleed Posted August 3, 2009 Author Posted August 3, 2009 Hello,Thank you very much indeed for the script.I am going to study it and am sure it will be very useful.Best regards,Waleed
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