jguinch Posted April 27, 2015 Share Posted April 27, 2015 Hi all !I work on a tool for automating logon in a business software. This software is a Linux application, displayed in Windows with an EXPORT DISPLAY method, using a X-SERVER (Cygwin/Xterm).The problem is when I use Send or ControlSend, special keys like @ or # (or some other keys needing an AltGr combination), the characters sent are the non-AltGr keys (# become 3, @ become 3 - I use a French keyboard).I tried to send keys to the Linux-Firefox (instead of the business software), but I had the same result.Does anyone has already try to make something like this, with the same issue ?Thanks for help Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
MikahS Posted April 27, 2015 Share Posted April 27, 2015 (edited) I've seen a couple posts on the forum about this same issue. Can you show us an example of what you're sending?You can always try sending with Chr like so:Send(Chr(35)) ; #Just a thought. Edited April 27, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
jguinch Posted April 27, 2015 Author Share Posted April 27, 2015 I tried with Chr but no, same problem.for example, I use this code :ControlSend("[REGEXPCLASS:cygwin/x; REGEXPTITLE:Utilisateur]", "", "", "P@$$w0rd!")The characters received by the X-SERVER are pà$$wàrd (the french keyboards has 0, @ and à in the same key)With another window (notepad), it works... Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
BrewManNH Posted April 27, 2015 Share Posted April 27, 2015 Try using the Raw flag in ControlSend. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
MikahS Posted April 27, 2015 Share Posted April 27, 2015 (edited) Try enclosing in brackets, like so:ControlSend("[REGEXPCLASS:cygwin/x; REGEXPTITLE:Utilisateur]", "", "", "P{@}$$w{0}rd{!}") Edited April 27, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
jguinch Posted April 27, 2015 Author Share Posted April 27, 2015 I never seen this parameter ... But unfortunately no, same issue.ControlSend("[REGEXPCLASS:cygwin/x]", "", "", "P@$$w0rd!", 1) ; ==> pà$$wàrd Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
mikell Posted April 27, 2015 Share Posted April 27, 2015 What aboutSend("{RALT DOWN}0{RALT UP}")? jguinch 1 Link to comment Share on other sites More sharing options...
SadBunny Posted April 27, 2015 Share Posted April 27, 2015 (edited) Same problem here. Problem is your Windows keyboard layout. If you change the keyboard layout to US it works fine, at least for me, at least in the cygwin CLASS:mintty window (default Cygwin terminal), even with characters like "¡²³" (which I just had to copypaste into the browser, btw, because these problems exist everywhere ).There are the _WinAPI_[Get|Set]KeyboardLayout() functions, but with my keyboard layout "US-International" I can't get it to run stable. Sometimes it works and sometimes it doesn't. No idea, but maybe it can get you started./edit: seems to often not work on the first try after manually setting my keyboard layout back to US/International (which apparently doesn't have a nice code ), but works if I repeat the script.Good luck and good night, I'm giving up now ;) #include <APILocaleConstants.au3> #include <WinAPILocale.au3> #include <WinAPISys.au3> $hWnd1 = WinGetHandle("") _WinAPI_SetKeyboardLayout($hWnd1, 0x0409) ; start or activate terminal Send("abc ¡²³") Edited April 27, 2015 by SadBunny jguinch 1 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
jguinch Posted April 27, 2015 Author Share Posted April 27, 2015 Thanks all. I will try all of this suggestions on tomorrow at work and give you a feedback. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
jguinch Posted April 28, 2015 Author Share Posted April 28, 2015 So, I just tried each suggestion : - MikahS : i tried Send("P{@}$$w{0}rd{!}", 1). result is P'=$$w'0=rd'!= (also tried with 0 or 1 as 2nd parameter) - Mikell : I tried Send("{RALT DOWN}0{RALT UP}") : then result is ° (I don't know why because it's not the good key...) - SadBunny : I tried, but no. I used _WinAPI_GetKeyboardLayout to retrieve the active layout. The result is 0x04090409 (english).With _WinAPI_SetKeyboardLayout($hWnd, 0x040C), I have the same behavior : it has no effect with the X-Window (the window seems to reject the WM_INPUTLANGCHANGEREQUEST message from _WinAPI_SetKeyboardLayout ) It works with this : Send("P{RALT DOWN}à{RALT UP}$$w0rd{!}"), but not with ControlSend (the @ becomes à)So it seems I will have to map all shit/altgr keys and generate a string to use with Send with this kind of code :Global $aKeys[13][2] = [["}", "{RALT DOWN}={RALT UP}"], _ ["{", "{RALT DOWN}'{RALT UP}"], _ ["!", "{!}"], _ ["+", "{+}"], _ ["~", "{RALT DOWN}é{RALT UP}"], _ ["#", "{RALT DOWN}""{RALT UP}"], _ ["[", "{RALT DOWN}({RALT UP}"], _ ["|", "{RALT DOWN}-{RALT UP}"], _ ["\", "{RALT DOWN}_{RALT UP}"], _ ["^", "{RALT DOWN}ç{RALT UP}"], _ ["@", "{RALT DOWN}à{RALT UP}"], _ ["]", "{RALT DOWN}){RALT UP}"], _ ["¤", "{RALT DOWN}${RALT UP}"] ] $sPassword = "#P@$$w0rd!" $sSendPassword = _MapAltGrKeys($sPassword) WinActivate("[REGEXPCLASS:cygwin/x]") Send($sSendPassword) Func _MapAltGrKeys($sString) For $i = 0 To UBound($aKeys) - 1 $sString = StringReplace($sString, $aKeys[$i][0], $aKeys[$i][1]) Next Return $sString EndFuncIt works, but I'm not really fan of this method... I would prefer a cleaner way.Thanks to all for your help, I can continue my code now ! Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF 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