TheONE Posted August 14, 2010 Share Posted August 14, 2010 Hello, I searched all over, but couldn't express myself in keywords. Just wanted to know how could we get the alternate character of a keyboard key (for the current keyboard layout). This is the one when shift is pressed (such as 'A' for 'a' and '@' for 2). I know I could check the status of shift with _IsPressed and subtract 32 from the character code to get the correct uppercase alphabet (Chr($Keycode - 32)). But what about others? Making a table won't solve my problem because of different keyboard layouts and regional settings. Please if anybody can take the time to help me out... Link to comment Share on other sites More sharing options...
BrettF Posted August 14, 2010 Share Posted August 14, 2010 Maybe: $str = "abc" & Chr (0xE4) & Chr (0xF6) & Chr (0xFC) & Chr (0xDF) MsgBox (0, "Lowercase", $str) MsgBox (0, "Uppercase", StringUpper ($str)) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
FlyinRiz Posted August 14, 2010 Share Posted August 14, 2010 Maybe: $str = "abc" & Chr (0xE4) & Chr (0xF6) & Chr (0xFC) & Chr (0xDF) MsgBox (0, "Lowercase", $str) MsgBox (0, "Uppercase", StringUpper ($str)) I thought it might, but if you use a symbol like $ (or Chr(0x24)) it stays the same for both. -Aaron Link to comment Share on other sites More sharing options...
FlyinRiz Posted August 14, 2010 Share Posted August 14, 2010 Hello,I searched all over, but couldn't express myself in keywords. Just wanted to know how could we get the alternate character of a keyboard key (for the current keyboard layout). This is the one when shift is pressed (such as 'A' for 'a' and '@' for 2). I know I could check the status of shift with _IsPressed and subtract 32 from the character code to get the correct uppercase alphabet (Chr($Keycode - 32)). But what about others? Making a table won't solve my problem because of different keyboard layouts and regional settings.Please if anybody can take the time to help me out...This is probably a very messy way of doing it, BUT I think it would work...if you open the virtual keyboard (which should change based on the selected keyboard layout), and hover over the keys (with Au3Info), it will display the Shift+Key, you could then use that to create a dynamic table at the beginning of your script based on key positions rather than key 'labels'. Again this is all in theory, but it might work.-Aaron Link to comment Share on other sites More sharing options...
FlyinRiz Posted August 14, 2010 Share Posted August 14, 2010 Proof of concept (XP SP3) Run(@systemdir & "\osk.exe") WinWait("On-Screen Keyboard") MsgBox(0,"` is:",ControlGetText("On-Screen Keyboard","",17)) MsgBox(0,"1 is:",ControlGetText("On-Screen Keyboard","",18)) MsgBox(0,"2 is:",ControlGetText("On-Screen Keyboard","",19)) MsgBox(0,"3 is:",ControlGetText("On-Screen Keyboard","",20)) MsgBox(0,"4 is:",ControlGetText("On-Screen Keyboard","",21)) MsgBox(0,"5 is:",ControlGetText("On-Screen Keyboard","",22)) MsgBox(0,"6 is:",ControlGetText("On-Screen Keyboard","",23)) MsgBox(0,"7 is:",ControlGetText("On-Screen Keyboard","",24)) MsgBox(0,"8 is:",ControlGetText("On-Screen Keyboard","",25)) -Aaron Link to comment Share on other sites More sharing options...
TheONE Posted August 15, 2010 Author Share Posted August 15, 2010 The virtual keyboard, yes, that's a way . I except there should be a windows API for gettng the keyboard layout. I also care about the fact that dfferent keyboard layouts have different characters for keycodes (Spanish, French and so). Thanks for the input! Link to comment Share on other sites More sharing options...
BrettF Posted August 15, 2010 Share Posted August 15, 2010 I was wondering if you could somehow use a "keyboard map" or whatever its called? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 15, 2010 Share Posted August 15, 2010 http://msdn.microsoft.com/en-us/library/ms646306%28VS.85%29.aspx Link to comment Share on other sites More sharing options...
TheONE Posted August 16, 2010 Author Share Posted August 16, 2010 That looks interesting, thanks Richard! Link to comment Share on other sites More sharing options...
Richard Robertson Posted August 17, 2010 Share Posted August 17, 2010 Sometimes you just have to know what to search for. I had actually read about this function in a technical article recently so it was fresh in my mind. Can't remember what the article was though. Figure that one out. Link to comment Share on other sites More sharing options...
TheONE Posted August 17, 2010 Author Share Posted August 17, 2010 The On-Screen Keyboard (osk.exe) has the following calls to "user32.dll" ActivateKeyboardLayoutAllowSetForegroundWindowBeginPaintCheckDlgButtonCheckMenuItemCheckMenuRadioItemChildWindowFromPointExCloseDesktopCloseWindowStationCreateWindowExWDefWindowProcWDestroyWindowDialogBoxParamWDispatchMessageWDrawIconExEnableMenuItemEnableWindowEndDialogEndPaintFindWindowWGetAsyncKeyStateGetClassInfoWGetClientRectGetCursorPosGetDCGetDesktopWindowGetDlgItemGetForegroundWindowGetKeyStateGetKeyboardLayoutGetKeyboardTypeGetMenuGetMessageWGetProcessWindowStationGetSysColorGetSystemMetricsGetThreadDesktopGetUserObjectInformationWGetWindowLongWGetWindowRectGetWindowThreadProcessIdInvalidateRectIsIconicIsWindowKillTimerLoadCursorWLoadIconWLoadImageWLoadStringWMapVirtualKeyExWMapVirtualKeyWMessageBoxWMoveWindowOpenDesktopWOpenInputDesktopOpenWindowStationWPostMessageWPostQuitMessageRegisterClassWRegisterWindowMessageWReleaseCaptureReleaseDCScreenToClientSendInputSendMessageWSetCaptureSetClassLongWSetCursorSetForegroundWindowSetProcessWindowStationSetThreadDesktopSetTimerSetWindowLongWSetWindowPosSetWindowRgnShowWindowToUnicodeExTranslateMessageUpdateWindowWinHelpWwsprintfAwsprintfWSearching for the functions I landed on this http://blogs.msdn.com/b/michkap/archive/2006/03/23/558658.aspx . The functions that do the trick are highlighted in bold. Link to comment Share on other sites More sharing options...
TheONE Posted August 17, 2010 Author Share Posted August 17, 2010 That means it's not as simple as I thought (detecting and handling dead keys and ligatures). Just in case someone looks for what I am trying to do.... 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