Suppir Posted November 16, 2009 Share Posted November 16, 2009 I have created hotkeys for my AutoIt application. These hotkeys run some functions. But if I activate another application (notepad), my AutoIt hotkeys working in this Notepad (causes some problems). How to restrict Autoit hotkey to set them working only if AutoIt application is active? Link to comment Share on other sites More sharing options...
Yashied Posted November 16, 2009 Share Posted November 16, 2009 See GUISetAccelerators(). 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... Link to comment Share on other sites More sharing options...
Suppir Posted November 16, 2009 Author Share Posted November 16, 2009 See GUISetAccelerators().Yashied I can set variables to accelerators, but functions do not work Link to comment Share on other sites More sharing options...
ProgAndy Posted November 16, 2009 Share Posted November 16, 2009 use GUICtrlCreateDummy and associate the function with the Dummy-Control #include <GUIConstants.au3> #region - GUI Create GUICreate('test') GUICtrlCreateLabel("Press ALT-A", 10, 10, 100, 30) $iDummy = GUICtrlCreateDummy() Dim $aAccel[1][2] = [ ["!a", $iDummy ]] GUISetAccelerators($aAccel) GUISetState() #endregion #region - GUI SelectLoop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $iDummy MsgBox(0, '', "Accelerator pressed") EndSelect WEnd #endregion *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 Link to comment Share on other sites More sharing options...
Suppir Posted November 16, 2009 Author Share Posted November 16, 2009 (edited) Oh, very thanks! Now I understand, that I was trying to use accelerators in wrong way. The problem is completely solved! Edited November 16, 2009 by Suppir Link to comment Share on other sites More sharing options...
Yashied Posted November 16, 2009 Share Posted November 16, 2009 Another way. $hForm = GUICreate('MyGUI') HotKeySet('^a', '_MyHotKeyFunc') GUISetState() Do Until GUIGetMsg() = -3 Func _MyHotKeyFunc() If BitAND(WinGetState($hForm), 8) Then MsgBox(0, '', 'CTRL-A is pressed!') Return EndIf HotKeySet('^a') Send('^a') HotKeySet('^a', '_MyHotKeyFunc') EndFunc ;==>_MyHotKeyFunc 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... Link to comment Share on other sites More sharing options...
Suppir Posted November 16, 2009 Author Share Posted November 16, 2009 Another way.Thank's a lot, Yashied. I will try it. 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