maniootek Posted September 22, 2015 Posted September 22, 2015 (edited) ;^ = ctrl, ! = alt HotKeySet("^!p", "Test") Func Test() MsgBox(0,0, "test!") EndFunc while 1 Sleep(100) WEndThis code run func "Test()" when I hit RALT + P (no need to hold ctrl), why?Added: Is it possible to declare hotkey with RIGHT CTRL? Edited September 22, 2015 by maniootek
Moderators Melba23 Posted September 22, 2015 Moderators Posted September 22, 2015 maniootek,A quick Google shows that on many keyboards (such as mine), the right Alt key is marked as "Alt Gr" so you can access special characters on some keys. it also appears that if your keyboard does NOT have this key, you can simulate it by pressing "Alt-Ctrl" - which implies that the "Alt Gr" key produces that same combination and so satisfies the HotKey request.This warning sums it up nicely:Therefore, it is recommended that this combination not be used as a modifier in Windows keyboard shortcuts as, depending on the keyboard layout and configuration, someone trying to type a special character with it may accidentally trigger the shortcut, or the keypresses for the shortcut may be inadvertently interpreted as the user trying to input a special character.If you want to limit the hotkey to just the {RCTRL) key then you will have to check _IsPressed inside the HotKey function.M23 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: Spoiler 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
maniootek Posted September 22, 2015 Author Posted September 22, 2015 Thank you. I didn't know about "Alt Gr"Where can I find HotKeySet() function code?
Moderators Melba23 Posted September 22, 2015 Moderators Posted September 22, 2015 maniootek,I meant inside the function code that you call when the HotKey is pressed - here is a simple example for which checks which SHIFT key was pressed:#include <MsgBoxConstants.au3> #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") HotKeySet("{ESC}", "_Exit") HotKeySet("+p", "Test") ; Shift-P While 1 Sleep(10) WEnd Func Test() If _IsPressed("A0", $hDLL) Then ; Left SHIFT key MsgBox($MB_SYSTEMMODAL, "Pressed", "LEFT Shift Key") Else ; Must be Right SHIFT key MsgBox($MB_SYSTEMMODAL, "Pressed", "RIGHT Shift Key") EndIf EndFunc ;==>Test Func _Exit() DllClose($hDLL) Exit EndFunc ;==>_ExitClearer now?M23 Parsix 1 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: Spoiler 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
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