Akshay07 Posted January 30, 2010 Share Posted January 30, 2010 Hi all, Assuming that a "hotkey" is used to end the script, is it possible to kill automatically any MsgBox that was displayed by the script? Thanks! Link to comment Share on other sites More sharing options...
martin Posted January 30, 2010 Share Posted January 30, 2010 (edited) Hi all, Assuming that a "hotkey" is used to end the script, is it possible to kill automatically any MsgBox that was displayed by the script? Thanks! If a messagebox is being shown then it will block the hotkey, so you need to get around that. Here is one way- If you hit the F1 key when the message box is displayed it will end the program. #include <misc.au3> #include <timers.au3> Global $MBTitle $gui = GUICreate("My GUI", 350, 300) GUISetState() msgboxB(262144, "title ABC", "Text") While 1 Sleep(90) WEnd Func msgboxB($flags,$stitle,$sText) $MBTitle = $stitle Local $Tmb = _Timer_SetTimer($gui, 80, "checkhk") MsgBox(262144, $stitle, $sText) _Timer_KillTimer($gui, $Tmb) EndFunc ;==>mesboxB Func checkhk($a, $b, $c, $d) If _IsPressed("70") Then; F1 key WinKill($MBTitle) Exit EndIf EndFunc ;==>checkhk Edited January 31, 2010 by martin 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. Link to comment Share on other sites More sharing options...
Akshay07 Posted February 2, 2010 Author Share Posted February 2, 2010 Thanks Martin! 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