Jump to content

Lanugage info on Mouse Cursor


Recommended Posts

Hi,

Again, a translator related issue.

I change programs to enter texts in a minute-base (unfortunatelly).

I have two active language layouts on my computer to let me type fast on both language. (English and Hungarian)

Now, the problem starts when changing between windows/softwares, the keyboard layout settings are based on the actual window. In too much of the cases I start typing something thinking that the keyboard layout is in one of the settings. 50% of the cases it is not true and I type stupid characters in. Then comes the deleting and retyping, which makes me crazy and off focuses of work.

Is it possible to read out the actual keyboard layout setting from the language bar and put it on the mouse cursor?

I am thinking to generate mosue cursors with EN, or HU additionals and change the mouse cursor(s) when keyboard layout changes. This part I would be able to program.

But how to read out the base information?

Thanks fro your help!

Link to comment
Share on other sites

The pont is that Hungarian language uses 9 more characters then English.

So, our special letters are placed on buttons which are important when typing in English or for example programming. Also, y-z are placed opposit to each other.

English typing needs full keyboard and Hungarian also, unfortunatelly there is no good way of mixing the two to one layout.

Link to comment
Share on other sites

Well, that is actually 18 and well more if you think of capitals also.

Let me give you an idea how this looks in life:

Left side is US and right is Hungarian keyboard. Starting from top left corner:

` ~=í Í

'=!

"=@

#=+

$=!

%=% (At least one in this row!)

^=/

&==

*=(

(=)

0=ö Ö

-=ü Ü

==ó Ó

qwertyuiop is the same

[=ő Ő

]=ú Ú

asdfghjkl is the same

; :=é É

' "=á Á

\ |=ű Ű

\ |=í, Í

zxcvbnm is the same

, <=, ?

. >=. :

/ ?=- _

Well, you guys can imagine, how keen I am to solve this issue as I wrote above...

Link to comment
Share on other sites

Try this:

$aLangnames = stringsplit( "Afrikaans|Albanian|Arabic – United Arab Emirates|Arabic - Bahrain|Arabic - Algeria|Arabic - Egypt|Arabic - Iraq|Arabic - Jordan|Arabic - Kuwait|Arabic - Lebanon|Arabic - Libya|Arabic - Morocco|Arabic - Oman|Arabic - Qatar|Arabic - Saudi Arabia|Arabic - Syria|Arabic - Tunisia|Arabic - Yemen|Armenian|Azeri – Latin|Azeri – Cyrillic|Basque|Belarusian|Bulgarian|Catalan|Chinese - China|Chinese - Hong Kong S.A.R.|Chinese – Macau S.A.R|Chinese - Singapore|Chinese - Taiwan|Croatian|Czech|Danish|Dutch – The Netherlands|Dutch - Belgium|English - Australia|English - Belize|English - Canada|English – Carribbean|English - Ireland|English - Jamaica|English - New Zealand|English – Phillippines|English - South Africa|English - Trinidad|English - United Kingdom|English - United States|Estonian|Farsi|Finnish|Faroese|French - France|French - Belgium|French - Canada|French - Luxembourg|French - Switzerland|Gaelic – Ireland|Gaelic - Scotland|German - Germany|German - Austria|German - Liechtenstein|German - Luxembourg|German - Switzerland|Greek|Hebrew|Hindi|Hungarian|Icelandic|Indonesian|Italian - Italy|Italian - Switzerland|Japanese|Korean|Latvian|Lithuanian|FYRO Macedonian|Malay - Malaysia|Malay – Brunei|Maltese|Marathi|Norwegian - Bokmål|Norwegian – Nynorsk|Polish|Portuguese - Portugal|Portuguese - Brazil|Raeto-Romance|Romanian - Romania|Romanian - Moldova|Russian|Russian - Moldova|Sanskrit|Serbian - Cyrillic|Serbian – Latin|Setsuana|Slovenian|Slovak|Sorbian|Spanish - Spain|Spanish - Argentina|Spanish - Bolivia|Spanish - Chile|Spanish - Colombia|Spanish - Costa Rica|Spanish - Dominican Republic|Spanish - Ecuador|Spanish - Guatemala|Spanish - Honduras|Spanish - Mexico|Spanish - Nicaragua|Spanish - Panama|Spanish - Peru|Spanish - Puerto Rico|Spanish - Paraguay|Spanish - El Salvador|Spanish - Uruguay|Spanish - Venezuela|Sutu|Swahili|Swedish - Sweden|Swedish - Finland|Tamil|Tatar|Thai|Turkish|Tsonga|Ukrainian|Urdu|Uzbek – Cyrillic|Uzbek – Latin|Vietnamese|Xhosa|Yiddish|Zulu","|")

; you'll have to fix the line below, it keeps changing the first quote sign to "&quot;"
$aLangcodes = stringsplit("1078|1052|14337|15361|5121|3073|2049|11265|13313|12289|4097|6145|8193|16385|1025|10241|7169|9217|1067|1068|2092|1069|1059|1026|1027|2052|3076|5124|4100|1028|1050|1029|1030|1043|2067|3081|10249|4105|9225|6153|8201|5129|13321|7177|11273|2057|1033|1061|1065|1035|1080|1036|2060|3084|5132|4108|2108|1084|1031|3079|5127|4103|2055|1032|1037|1081|1038|1039|1057|1040|2064|1041|1042|1062|1063|1071|1086|2110|1082|1102|1044|2068|1045|2070|1046|1047|1048|2072|1049|2073|1103|3098|2074|1074|1060|1051|1070|1034|11274|16394|13322|9226|5130|7178|12298|4106|18442|2058|19466|6154|10250|20490|15370|17418|14346|8202|1072|1089|1053|2077|1097|1092|1054|1055|1073|1058|1056|2115|1091|1066|1076|1085|1077","|")


$dll = dllopen("user32.dll")
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
while 1
    tooltip(langundermouse())
    sleep(1000)
WEnd
dllclose($dll)

func langundermouse()
    $langcode = DllCall($dll,"long","GetKeyboardLayout","int",firstthreadidundermouse())
    $lowdec = BitAND($langcode[0],0xFFFF) ; based on a function from Larry

    for $i = 1 to $aLangcodes[0]
        $strLang = "Unknown"
        if $aLangcodes[$i] = $lowdec Then
            $strLang = $aLangnames[$i]
            ExitLoop
        EndIf
    Next
    
    return $strlang & " ["&$lowdec&"]"  
    
EndFunc

func firstthreadidundermouse()
    $curpid = pidundermouse()
    $colThreads = $objWMIService.ExecQuery("SELECT * FROM Win32_Thread WHERE ProcessHandle = '"& $curpid &"'")
    For $objThread in $colThreads
        return $objThread.Handle
    Next
EndFunc

func pidundermouse()
    return WinGetProcess(windowundermouse())
EndFunc

func windowundermouse()
    local $hwnd
    $hwnd = WindowFromPoint()
    do
        $last = $hwnd
        $arParent = DllCall($dll, "hwnd", "GetParent", "hwnd", $hwnd)
        $hwnd = $arParent[0]
    until not $hwnd
    $hwnd = $last
    return $hwnd
    ;return WinGetTitle($hwnd, "")
endfunc





; WindowFromPoint from Larry
Func WindowFromPoint()
    Local $point, $cHwnd, $hwnd, $pos, $size
    $point = MouseGetPos()
    $hwnd = DLLCall($dll, "hwnd", "WindowFromPoint", "int", $point[0], "int", $point[1])
    If $hwnd[0] <> 0 Then
        $pos = WinGetPos($hwnd[0])
        If @error Then Return 0
        $size = WinGetClientSize($hwnd[0])
        If @error Then Return 0
        $pos[0] += (($pos[2] - $size[0]) / 2)
        $pos[1] += (($pos[3] - $size[1]) - (($pos[2] - $size[0]) / 2))
        $cHwnd = DLLCall($dll,"hwnd","RealChildWindowFromPoint","hwnd",$hwnd[0], _
                    "int",$point[0] - $pos[0],"int",$point[1] - $pos[1])
        If $cHwnd[0] <> 0 Then $hwnd[0] = $cHwnd[0]
    EndIf
    Return $hwnd[0]
EndFunc
Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Hey!!!

This looks absolutely fantastic!

Did you make this up with all the mathematics right now?

I am impressed.

Altough I do not really have a clue what it does and how it does it, but shows English when in English and Unknown, when in Hungarian.

Which is pretty much I've been looking for!

From this point, the rest should be a sunday walk in a nice forest!

Thanks so much!

Link to comment
Share on other sites

Well it should say Unknown [codenumber #]. If you tell me the code # I can add hungarian, or you can do it by adding "Hungarian|" and "codenumber|" to the beginnings of the appropriate array data strings.

Yes, I did do this just now. I was initially going to tell you it wouldn't be possible after a little research, but then I kept finding the right information leading to a solution. I wrote all of the functions from scratch that aren't attributed to others.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Well it should say Unknown [codenumber #]. If you tell me the code # I can add hungarian, or you can do it by adding "Hungarian|" and "codenumber|" to the beginnings of the appropriate array data strings.

Yes, I did do this just now. I was initially going to tell you it wouldn't be possible after a little research, but then I kept finding the right information leading to a solution. I wrote all of the functions from scratch that aren't attributed to others.

Hi,

This is great!

It works perfectly now.

With a little research on hacking the mouse cursor I heve found this:

http://www.autoitscript.com/forum/index.php?showtopic=32676

This draws a circle around the cursor, but with some simple re-hacking I made it to put letter into a box.

Then I joined the two program with small work and now my face is happy.

The Hungarian and the code is in your strings, but somehow just doesn't come out. Anyway, since your script nicely shows the DIFFERENCE, that's enough for me.

Thanks again.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...