Yashied Posted March 1, 2009 Posted March 1, 2009 (edited) LAST VERSION - 1.8 / 2.1b25-Dec-13The library allows to set hotkeys by using the low-level keyboard hook. Below are the main differences between HotKey UDF from the native HotKeySet() function:To assign a hotkeys are used integer values instead of strings as in the HotKeySet() function. This is useful, for example, to save the hotkey's values in the registry.Ability to set any hotkeys including CTRL+ALT+DEL, F12, WIN+*, etc. The only exceptions are special keys such as "Fn" which do not have their own scan code.Ability to utilize or pass on the specified hotkeys for other applications.Ability to set hotkeys that already used by other applications.Ability to set hotkeys only for the specified window(s).Ability to prevent re-activation of the hotkeys when it is held down.Ability to disable previously installed hotkeys without removing the hook from the hook chain, ie without losing priority.Ability to block call user-defined function associated with the hotkey if the previous call has not been completed.Here is what you can't do by using this library:Set hotkey only for the CTRL, ALT, SHIFT, WIN, and any combination of this keys. Any hotkey should always include one function key. For example, ALT+A, CTRL+SHIFT+F10, etc.Set hotkey for a mouse buttons.Prevent using the hotkey like CTRL+ALT+DEL, CTRL+SHIFT+ESC (Windows Vista+), and similar.Use more than one function key in the hotkey. For example, ALT+A+B, F1+F2, etc.Use "Fn" key or any other keys that do not have their own scan code.Available functions_HotKey_Assign_HotKey_Enable_HotKey_Disable_HotKey_ReleaseHotKey UDF Library v1.8Previous downloads: 5027HotKey.au3HotKey UDF Library v2.1b (Read >here for more information)Previous downloads: 1791HotKey_21b.au3Virtual-Key (VK) Code Constants (Optional)Previous downloads: 1576vkConstants.au3Example1#Include <HotKey.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_F12 = 0x7B ; Assign "F12" with Message() and set extended function call _HotKey_Assign($VK_F12, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) ; Assign "CTRL-ESC" with Quit() _HotKey_Assign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit') While 1 Sleep(10) WEnd Func Message($iKey) MsgBox(0, 'Hot key Test Message', 'F12 (0x' & Hex($iKey, 4) & ') has been pressed!') EndFunc ;==>Message Func Quit() Exit EndFunc ;==>QuitExample2#Include <HotKey.au3> Global Const $VK_OEM_PLUS = 0xBB Global Const $VK_OEM_MINUS = 0xBD Global $Form, $Label Global $i = 0 $Form = GUICreate('MyGUI', 200, 200) $Label = GUICtrlCreateLabel($i, 20, 72, 160, 52, 0x01) GUICtrlSetFont(-1, 32, 400, 0, 'Tahoma') GUISetState() ; Assign "CTRL-(+)" with MyFunc1() and "CTRL-(-)" with MyFunc2() for created window only _HotKey_Assign(BitOR($CK_CONTROL, $VK_OEM_PLUS), 'MyFunc1', 0, $Form) _HotKey_Assign(BitOR($CK_CONTROL, $VK_OEM_MINUS), 'MyFunc2', 0, $Form) Do Until GUIGetMsg() = -3 Func MyFunc1() $i += 1 GUICtrlSetData($Label, $i) EndFunc ;==>MyFunc1 Func MyFunc2() $i -= 1 GUICtrlSetData($Label, $i) EndFunc ;==>MyFunc2 Edited February 6, 2014 by Yashied Xandy and misrepresentative 2 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
ProgAndy Posted March 1, 2009 Posted March 1, 2009 What's wrong with HotKeySet() ? This is much easier *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Yashied Posted March 1, 2009 Author Posted March 1, 2009 (edited) What's wrong with HotKeySet() ? This is much easier Differences HotKeySet() from HotKeyAssign():Removed. (See first post) Edited August 17, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
WeMartiansAreFriendly Posted March 1, 2009 Posted March 1, 2009 Very nice idea. :thumsup: Unfortunately the script crashes after it exits. I'm using Vista SP1, AutoIt 3.2.12.1 Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
ProgAndy Posted March 1, 2009 Posted March 1, 2009 OK, with the description, i see the advantages Great work. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Yashied Posted March 1, 2009 Author Posted March 1, 2009 (edited) Thanks for your reply. I specifically used as a hotkey code number, not the string value in HotKeySet (). When writing a complete application where necessary to keep the hotkeys code (such as the registry), it is better to use the number. Edited March 1, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Yashied Posted March 1, 2009 Author Posted March 1, 2009 Very nice idea. :thumsup:Unfortunately the script crashes after it exits. I'm using Vista SP1, AutoIt 3.2.12.1 Try AutoIt v3.3.0.0. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Yashied Posted March 2, 2009 Author Posted March 2, 2009 Who are interested, I updated the HotKey.au3. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
BrammerTheHammer Posted April 2, 2009 Posted April 2, 2009 OMG, thank you, I have been looking for this for a long time, I was about to write a program from scratch. I am try to make a my own hotkeys, such as Win+Alt+F calling a function which sends a Shift+Right. Using HotKeySet the alt key would randomly get passed to the active window 50% of the time. So far, using your program the alt key only gets passed if I have an Office2007 app or OpenOffice as the active window and press the windows key first. Do you know of any way to fix this small problem, other than training myself to press the alt key first? Also, is there a way to use your program to capture the windows key so that it does not open the StartMenu, but still works for the hot keys? I tried capturing using VK_LWIN but it blocked the hot keys that used CK_WIN. I will be trying to set approximately 90 hot keys, including the blocked ones (Win+K, Win+U). I will reply to this thread with my findings. Again, thank you, this is a vast improvement. BTH
Yashied Posted April 6, 2009 Author Posted April 6, 2009 This library has been updated. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Yashied Posted April 16, 2009 Author Posted April 16, 2009 OMG, thank you, I have been looking for this for a long time, I was about to write a program from scratch. I am try to make a my own hotkeys, such as Win+Alt+F calling a function which sends a Shift+Right. Using HotKeySet the alt key would randomly get passed to the active window 50% of the time. So far, using your program the alt key only gets passed if I have an Office2007 app or OpenOffice as the active window and press the windows key first.Do you know of any way to fix this small problem, other than training myself to press the alt key first? Also, is there a way to use your program to capture the windows key so that it does not open the StartMenu, but still works for the hot keys? I tried capturing using VK_LWIN but it blocked the hot keys that used CK_WIN.I will be trying to set approximately 90 hot keys, including the blocked ones (Win+K, Win+U). I will reply to this thread with my findings.Again, thank you, this is a vast improvement.BTHHi, BrammerTheHammer. I completely rewrote this library. Now she is working as I thought from the beginning. I suggest first to read the comments in the file. I have made many changes and additions. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Zedna Posted June 5, 2009 Posted June 5, 2009 Looks like very strong UDF. But internal code is quite complicated. Thanks for sharing anyway Yashied. Resources UDF ResourcesEx UDF AutoIt Forum Search
Yashied Posted June 5, 2009 Author Posted June 5, 2009 Looks like very strong UDF. But internal code is quite complicated.Thanks for sharing anyway Yashied.Thank you, Zedna. I tried to ease this UDF, but most have no choice (if only at the expense of his work). I wrote a long time it, and then repairs, and then completely rewrote this library, and now it works exactly as I designed from the outset. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Zedna Posted June 5, 2009 Posted June 5, 2009 I have no use for it now but I like such educative scripts where you can learn something new and see what all is possible to do in Win32API/AutoIt :-) Resources UDF ResourcesEx UDF AutoIt Forum Search
KenNichols Posted June 15, 2009 Posted June 15, 2009 Thanks, Works Great! [topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!
nguyenbason Posted June 26, 2009 Posted June 26, 2009 Can i set on textbox or editbox? (Like when input something, press enter go to function) UnderWorldVN- Just play the way you like it
Yashied Posted June 26, 2009 Author Posted June 26, 2009 #Include <HotKey.au3> Global Const $VK_RETURN = 0x0D Global $Edit, $hEdit GUICreate('Test', 400, 400) $Edit = GUICtrlCreateEdit('', 10, 10, 380, 380) $hEdit = GUICtrlGetHandle($Edit) GUISetState() _HotKeyAssign($VK_RETURN, 'MyFunc', $HK_FLAG_NOBLOCKHOTKEY) Do Until GUIGetMsg() = -3 Func MyFunc() If _WinAPI_GetFocus() <> $hEdit Then Return EndIf ConsoleWrite('OK' & @CR) EndFunc ;==>MyFunc My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
nguyenbason Posted June 26, 2009 Posted June 26, 2009 #Include <HotKey.au3> Global Const $VK_RETURN = 0x0D Global $Edit, $hEdit GUICreate('Test', 400, 400) $Edit = GUICtrlCreateEdit('', 10, 10, 380, 380) $hEdit = GUICtrlGetHandle($Edit) GUISetState() _HotKeyAssign($VK_RETURN, 'MyFunc', $HK_FLAG_NOBLOCKHOTKEY) Do Until GUIGetMsg() = -3 Func MyFunc() If _WinAPI_GetFocus() <> $hEdit Then Return EndIf ConsoleWrite('OK' & @CR) EndFunc ;==>MyFuncThanks, but i tried your example but nothing happened, console has no output. UnderWorldVN- Just play the way you like it
crashburn Posted June 27, 2009 Posted June 27, 2009 nice... i've been working allday just to find a solution for setting hotkey to a specified window, and heres the answer. ty
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