BillW92 Posted July 9, 2007 Posted July 9, 2007 Hi all, been using AutoIt for a couple weeks now... pretty neat stuff. I'm working on a GUI application (notepad clone - I always do one when learning a new language) which uses HotKeySet(). Unfortunately, it seems to be setting system-wide hotkeys, with no ability to limit it to one window. Searching the forum, I found a thread with this as a feature request. Has this functionality been added, and I've just missed it in the helpfile? Or, perhaps, is there a UDF that gets the job done? TIA, Bill Bill W. | aka equallyskilledWindows XP MCE | AutoIt v3.2.10.0My Scripts: RBTray | SyncM3U.au3
martin Posted July 9, 2007 Posted July 9, 2007 Hi all, been using AutoIt for a couple weeks now... pretty neat stuff. I'm working on a GUI application (notepad clone - I always do one when learning a new language) which uses HotKeySet(). Unfortunately, it seems to be setting system-wide hotkeys, with no ability to limit it to one window. Searching the forum, I found a thread with this as a feature request. Has this functionality been added, and I've just missed it in the helpfile? Or, perhaps, is there a UDF that gets the job done?TIA, BillIf you mean that when you hit the hot key combination the script will react even if it doesn't have focus then all you have to do is add something like this to the defined function for the hot key-Func myhotkey1()If not WinACtive("my gui Title") then return....Is that what you mean? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
BillW92 Posted July 10, 2007 Author Posted July 10, 2007 (edited) If you mean that when you hit the hot key combination the script will react even if it doesn't have focus then all you have to do is add something like this to the defined function for the hot key-Func myhotkey1()If not WinACtive("my gui Title") then return....Is that what you mean?Yes, it is... I would rather not have to include the check, though. Oh well. Thanks anyway.... Edited July 10, 2007 by BillW92 Bill W. | aka equallyskilledWindows XP MCE | AutoIt v3.2.10.0My Scripts: RBTray | SyncM3U.au3
Emiel Wieldraaijer Posted July 10, 2007 Posted July 10, 2007 (edited) I believe you are looking for something like this #include <Misc.au3> Include in you While/Wend Loop if BitAND (_IsPressed ("12"), _IsPressed ("58")) and WinActive ("YourGuiName") Then Exit this is ALT-X only active in the masterscreen of your GUI. When you remove the "and WinActive ("YourGuiName") " then it will be available in the whole GUI Look for _IsPressed in the Help File Best regards, Emiel Wieldraaijer Edited July 10, 2007 by Emiel Wieldraaijer Best regards,Emiel Wieldraaijer
Wooltown Posted July 10, 2007 Posted July 10, 2007 Excerpt from my scriptOpt("GUIOnEventMode", 1) Global Const $WM_ACTIVATEAPP = 0x001C Global Const $GUI_Main_Title = "My GUI" Global Const $LVM_GETITEM = $LVM_FIRST + 5 GUIRegisterMsg($WM_ACTIVATEAPP, "_ToggleHotkeys") GUCreate ("MyGUI",100,100) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIExit") While 1 Sleep(1000) Wend ; ===================================================================================== Func _ToggleHotkeys() If WinActive($GUI_Main_Title) Then HotKeyEnable() Else HotKeyDisable() EndIf EndFunc ; ===================================================================================== Func HotKeyEnable() HotKeySet("^w","FunctionName") EndFunc ; ===================================================================================== Func HotKeyEnable() HotKeySet("^w") EndFuncThis is the way I do it, remember for performance reason, Always use Opt("GUIOnEventMode", 1)Hope you understand else just ask.
BillW92 Posted July 11, 2007 Author Posted July 11, 2007 Excerpt from my script This is the way I do it, remember for performance reason, Always use Opt("GUIOnEventMode", 1) Hope you understand else just ask. Very nice! thank you very much. Bill W. | aka equallyskilledWindows XP MCE | AutoIt v3.2.10.0My Scripts: RBTray | SyncM3U.au3
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