Jump to content

Unfocus a Window temporarily


 Share

Recommended Posts

Hi there,

What am I trying to do is open a Notepad, then type something in Korean in it and close the Notepad. In theory, it's pretty simple. However, Microsoft decided to chose the key "ALT GR" (right alt), so switch between English and Korean input mod. So basically, when I open the Notepad, I press RALT, but it goes to the toolbar (File, Edit, etc), instead of switching the input type. I think it's because the RALT key actually doesn't press the ALTGR key, but rather the regular ALT key...

So 2 options for me :

  • I unfocus the notepad, press right alt, and focus the notepad again (may not solve the problem, since RALT doesn't work)

  • I find a way to press ALT+GR using autoit (RALT doesn't work)

Any clues ? How can I simulate the ALTGR key ?

Thank you very much

Edited by Prx3k
Link to comment
Share on other sites

Decipher,

Indeed, except for the language toolbar, which requires the ALTGR key to be pressed. If I do CTRL+ALT (not even using AutoIt here), the input mod doesn't change. It does only switch when I press the ALTGR key.

Link to comment
Share on other sites

No more success :

AutoIt isn't the problem here, it's Windows itself... AltGr is equivalent with CTRL+ALT, except for this. Plus, ALTGR seems to be a key modifier, so I guess there is no ASCII code to simulate it :/

Link to comment
Share on other sites

  • 3 weeks later...

Shotgun approach since I can't test here:

Send("{RALT down}yourkeyhere{RALT up}")

Send("^!yourkeyhere")

Send("{CTRL down}{ALT down}yourkeyhere{ALT up}{CTRL up}")

?

There's probably some better way we could do this if we knew the scancode.

Alternatively, if you already know what text you want in notepad, use a different method than AltGR+Send to send the unicode text to notepad.

Eg:

See the Appendix for some tips on using Send. AutoIt can send all ASCII and Extended ASCII characters (0-255), to send UNICODE characters you must use the "ASC" option and the code of the character you wish to send (see {ASC} at the bottom of the table below).

For a given unicode string I would think you could do something like:

For $i=1 To StringLen($str)
    Local $c=StringMid($str,$i,1)
    Local $a=AscW($c)
    If $a>0xFF Then
        Send("{ASC "&$a&"}")
    Else
        Send($c,1)
    EndIf
Next

But even that seems unnecessary and redundant.

Edit: According to the help file, ASC must be used for unicode; but using Send() with the Raw flag set to 1 works fine for me?

WinActivate("Untitled - Notepad")
Local $str=BinaryToString("0x019C019D",3);Latin Turned M, N with Left Hook
Send($str,1)
Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

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...