Sign in to follow this  
Followers 0
Akshay07

Kill MsbBox automatically when ending the program with a hotkey

3 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 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.

Share this post


Link to post
Share on other sites

Thanks Martin!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0