prx3k Posted April 17, 2013 Share Posted April 17, 2013 (edited) 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 April 17, 2013 by Prx3k Link to comment Share on other sites More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 (edited) Prx3k, Welcome to the AutoIt Forums, This seems to work well. Opt("WinTitleMatchMode",4) WinActivate("[CLASS:Shell_TrayWnd]") Send("{LCTRL}{RALT}") ;- OR Send("^{ALT}" ;- OR Send("^!") WinActivate("[CLASS:Notepad]") *Edit - Added some options Anonymous Edited April 17, 2013 by Decipher Spoiler Link to comment Share on other sites More sharing options...
prx3k Posted April 17, 2013 Author Share Posted April 17, 2013 Thanks for your answer, however it seems I need to press ALTGR, and RALT =/= ALTGR for whatever reason... I am on a French keyboard Link to comment Share on other sites More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 (edited) Prx3k,Wikipedia state that ALTGR = Ctrl+Althttp://en.wikipedia.org/wiki/AltGr_key*Edit - Send("{LCTRL}{LALT}{RALT}") ; - Maybe this is want you need?Anonymous Edited April 17, 2013 by Decipher Spoiler Link to comment Share on other sites More sharing options...
prx3k Posted April 17, 2013 Author Share Posted April 17, 2013 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 More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 Prx3k, Try Send('!Gr') Anonymous Spoiler Link to comment Share on other sites More sharing options...
prx3k Posted April 17, 2013 Author Share Posted April 17, 2013 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 More sharing options...
Decipher Posted April 17, 2013 Share Posted April 17, 2013 Prx3k, Maybe it is working and the application isn't responding quick enough. Try increasing the key release delay. Opt("SendKeyDownDelay", 15) Anonymous Spoiler Link to comment Share on other sites More sharing options...
prx3k Posted April 17, 2013 Author Share Posted April 17, 2013 Still no success... It would be great if a moderator could change the title to "Simulate ALTGR with AutoIt" or something like this Link to comment Share on other sites More sharing options...
Decipher Posted May 5, 2013 Share Posted May 5, 2013 You can do that yourself. Edit your initial post using the full editor and change it. Spoiler Link to comment Share on other sites More sharing options...
crashdemons Posted May 5, 2013 Share Posted May 5, 2013 (edited) 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 May 5, 2013 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 More sharing options...
MouseSpotter Posted May 6, 2013 Share Posted May 6, 2013 If all you are doing is switching between languages - Regional and Language Options has the ability to reassign the key sequences to this. 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