Sori Posted October 18, 2013 Posted October 18, 2013 (edited) I have tried 2 solutions, with 2 different issues. ---------------------------------------------------------Attempt 1:expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> Dim $reRouteKeys = 1 Global $hHook, $hStub_KeyProc, $buffer = "" Local $hmod $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") $hmod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) While 1 If $reRouteKeys = 1 Then ToolTip("ReRoute: On", 5, 5) Else ToolTip("ReRoute: Off", 5, 5) EndIf WEnd Func EvaluateKey($keycode) If $keycode = 65 Then If $ReRouteKeys = 1 Then send("{1}") EndIf EndIf EndFunc ;=========================================================== ; callback function ;=========================================================== Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Then EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode")) Else Local $flags = DllStructGetData($tKEYHOOKS, "flags") Switch $flags Case $LLKHF_ALTDOWN ConsoleWrite("$LLKHF_ALTDOWN" & @CRLF) Case $LLKHF_EXTENDED ConsoleWrite("$LLKHF_EXTENDED" & @CRLF) Case $LLKHF_INJECTED ConsoleWrite("$LLKHF_INJECTED" & @CRLF) Case $LLKHF_UP ConsoleWrite("$LLKHF_UP: scanCode - " & DllStructGetData($tKEYHOOKS, "scanCode") & @TAB & "vkCode - " & DllStructGetData($tKEYHOOKS, "vkCode") & @CRLF) EndSwitch EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc The problem: When I press "a" it sends "1a"How do I prevent the passthrough?--------------------------------------------------------- Attempt 2:#Include <HotKey.au3> #Include <vkConstants.au3> Dim $reRouteKeys = 1 _HotKey_Assign($VK_A, 'Message') ; Assign "CTRL-ESC" with Quit() _HotKey_Assign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit') While 1 If $reRouteKeys = 1 Then ToolTip("ReRoute: On", 5, 5) Else ToolTip("ReRoute: Off", 5, 5) EndIf WEnd Func Message() If $reRouteKeys = 1 Then Send("{1}") Else Send("{a}") EndIf EndFunc ;==>Message Func Quit() Exit EndFunc ;==>Quit The problem: Send() does nothing.If you place MsgBox(0, "Test", "Test") in the section, it will trigger the message box, so the function is being called, but send isn't working. Edited October 18, 2013 by Melba23 Added code tags If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
Moderators Melba23 Posted October 18, 2013 Moderators Posted October 18, 2013 (edited) Sorimachi, Quote That took me a bit to color code it allIf you use code tags - see here how to do it you get a scrolling box and syntax colouring as you can see above now I have added the tags. M23Edit: And welcome to the AutoIt forum, by the way. Edited October 18, 2013 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Reveal hidden contents ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
water Posted October 18, 2013 Posted October 18, 2013 Sorimachi, welcome to AutoIt and the forum! Can you please tell us why you need to reroute keypresses? My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Sori Posted October 18, 2013 Author Posted October 18, 2013 The idea popped in my head for a context sensitive keyboard. I don't know what I would do with it though I figured I would get the coding then throw it on the backburner for future useage. And it's also challenging me and I don't like to be challenged. If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
Sori Posted October 18, 2013 Author Posted October 18, 2013 I found this. '?do=embed' frameborder='0' data-embedContent>> It doesn't care about capitals or lowercase, is there a way to modify that? If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
Solution Sori Posted October 18, 2013 Author Solution Posted October 18, 2013 Using a mixture of ispressed and send() I got it all coded. Thank you for trying to help. If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects.
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