ChrisL Posted July 17, 2007 Share Posted July 17, 2007 (edited) This is something I wrote for a guy in the support forum. I have cut it down to show the basics of how it works.The issue was that when using multiple hotkeys with functions which took some time to process, the first hotkey function would not complete if a subsiquent hotkey was pressed until the second hotkey function had finished. You end up with actions which could run out of sequence.The code below will queue the Hotkeys and run them in order One at a time. You can set hotkeys that are allowed to queue. If you use the standard HotkeySet method then this/these hotkeys will interupt the queue.If you try the below code and type abababababababab follewed by the c key you will see in the Scite console pain the hotkeys are buffered and the each function will not run until it's turnIf you run the script again and type abababababababab then the esc key you will see the esc key will jump the queue and exit the script, if the esc key performed another action other than exit then this would be performed and then the queue would be continued#include "HotKeyBuffer.au3" _HotKeySet("a","MyaFunc") _HotKeySet("b","MybFunc") _HotKeySet("c","MycFunc") HotkeySet("{esc}","_quit") While 1 Sleep(100) WEnd Func MyaFunc() ConsoleWrite("This is my a function" & @crlf) Sleep(2000) EndFunc Func MybFunc() ConsoleWrite("This is my b function" & @crlf) Sleep(2000) EndFunc Func MycFunc() Msgbox(0,"","C key all done") Exit EndFunc Func _quit() Exit EndfuncEdited to make this a UDF for ease of useHotKeyBuffer.au3 Edited March 20, 2008 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted March 20, 2008 Author Share Posted March 20, 2008 made this into a include file for ease of use [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
monoceres Posted March 21, 2008 Share Posted March 21, 2008 If you had released this before _IsPressed() was included in the autoit release I would have loved you It's a really nice script though, Good Work! Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
DirtDBaK Posted March 23, 2008 Share Posted March 23, 2008 Nice, this thread explains why pressing next really quiclky in AMP cuases it to play multiple files.... Thanks [center][/center] 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