Mechaflash Posted April 19, 2012 Share Posted April 19, 2012 Trying to figure out a way to disable and renable hotkeys at my beckoning. I've set hotkeys for my GUI buttons to scroll through some images ({pgup} and {pgdn}). Once in a while, the image viewer will lag so the user hits the key multiple times (as most do when something doesn't work they press the button again and again thinking that it helps ) so it queues up the function that the hotkey was bound to and now they have an auto-scrolling gallery for X amount of times they pressed the hotkey. So I want to disable them for a period of time and then re-enable them. Has anyone done this before? Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Mat Posted April 19, 2012 Share Posted April 19, 2012 Disable it at the start of the function, and re-enable it at the end. It is fairly common practice for longer functions. Are you actually using hotkeys or are you using accelerators? AutoIt Project Listing Link to comment Share on other sites More sharing options...
Xandy Posted April 19, 2012 Share Posted April 19, 2012 (edited) This is how avoid spamming the hotkeys. func hotkeyfunction900() hotkeyset($hk[900][9]);disable the hotkey dofunction(900);do the function based on the specification of $hk[900][] hotkeyset($hk[900][9], "hotkeyfunction900");reassign the hotkey after the function is complete Endfunc Edited April 19, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Mechaflash Posted April 19, 2012 Author Share Posted April 19, 2012 @Mat using HotKeySet() as I want them accessible even if the app doesn't have focus. And GAH! just delete this thread =/ stupid me I just noticed the helpfile states "Not specifying this parameter will unset a previous hotkey." for the second paramter of HotKeySet [, "function"] I will now take my life in the most disgusting manner possible. Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
Zedna Posted April 19, 2012 Share Posted April 19, 2012 Just for your info: Here is my example about using guisetaccelerators as replace for hotkeyset Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Xandy Posted April 19, 2012 Share Posted April 19, 2012 (edited) I totally just showed you that in my code example. Sheesh. I learnt it from the help file too! Edited April 19, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) 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