Sign in to follow this  
Followers 0
CoePSX

MJK

4 posts in this topic

#1 ·  Posted (edited)

EDIT: Latest version with source-code at http://sourceforge.net/projects/mjk/

Well, this is not autoit, but I believe it can be useful to some people who know a little japanese or want to learn it.

This is a little tool I made to make easy typing simple japanese text (No Kanjis).

It's fully written in C, and it's very simple to understand, since the principles can be easily adapted to autoit.

I did it in C because at work I can't have AutoIt, but I have Visual Studio 2005 (that crappy one) with C++ compiler. Most of it was written there, I just made icons and compiled at home using Pelles C.

This is how it works:

 - The program registers a hotkey for every letter key and some special keys using RegisterHotkey.

 - The hidden window receives the hotkey messages, and it uses a temporary string to parse the japanese letters.

 - The user-interface is limited to a interactive tray icon.

Works by just typing things in japanese. Like the sentence "Boku wa kirei desu ne."

Becomes ぼく わ きれい です ね。It has katakana letters too. :)

Don't get scared by the code. 95% of it are just switches and cases to handle the letter combinations.

And yes, I always give ridiculous names to my programs, most of them starting with the word Magic. :D

I hope someone can find some use to it.

The executable with source code and Pelles C project is attached.

If you find any bugs, tell me so I can fix it. Any comments are welcome. :D

EDIT: See update on post below.

MJK.zip

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites



ああ、すごい とてもすごいです

^^ Thats with my IME ^^

BB, YTD hfYTDgY

^^ That's with the program ^^

Maybe i did something wrong?

If i could get this to work, maybe it could replace my IME. I set it to hiragana, and typed in "aa, sugoi. totemo sugoi desu"

Maybe it's just my pc. If so then good job CoePSX-San. I've actually been studying japanese for about a year.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, I noticed it didn't work on lots of windows. It was using the same method AutoIt does to send unicode chars on last case, by doing Alt+0xxxx simulation.

I adapted it to use SendInput now. Since Windows 95 doesn't support it, it has a compatibility replacement.

void SendUnicode (wchar_t iUnicode) {
    // Add 60h to the unicode if it's in katakana mode //
    if (iMode == MODE_KATAKANA)
        if ((iUnicode <= LETTER_N) && (iUnicode >= LETTER_SMALLA))
            iUnicode += 0x60;

    // Send the character //
    if (bNT)
        _SendUnicodeNT (iUnicode);
    else
        _SendUnicode95 (iUnicode);

    return;
}
void _SendUnicode95 (wchar_t iUnicode) {
    char szUnicode[8];
    int i;
    int iLen;
    
    // Make a 0XXXX string //
    sprintf (szUnicode, "0%d", iUnicode);
    iLen = strlen (szUnicode);

    // Send the ALT+0XXX combination //
    keybd_event (VK_MENU, 0, 0, 0);
    for (i=0; i<iLen; i++)
        SendKey (VkKeyScan (szUnicode[i]) + 0x30);
    keybd_event (VK_MENU, 0, KEYEVENTF_KEYUP, 0);
    
    return;
}
void _SendUnicodeNT (wchar_t iUnicode) {
    INPUT stInput = {0};
    stInput.type = INPUT_KEYBOARD;
    stInput.ki.wScan = iUnicode;
    stInput.ki.dwFlags = KEYEVENTF_UNICODE;

    // Here we use SendInput to send the character //
    SendInput (1, &stInput, sizeof(INPUT));

    return;
}

I changed the version to 0.4, and it's attached with source code on MJK04.zip. This version should be much better to use than the other one, since it even works on IE 6. :)

EDIT: Invision is playing with my mind.

mjk04.zip

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

ああ, すごい です! とてもすごいです!

It works!

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