slightly_abnormal Posted March 26, 2006 Posted March 26, 2006 (edited) been trying this script to close itself if the window is not active in 5 seconds, it doesn't do that. it just freezes itself.. #include <GuiConstants.au3> $GUI = GuiCreate("Example",200,200,-1,-1) GuiSetState() _keepmouse() while 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE sleep(100) EndSelect WEnd Func _keepmouse() Opt("wintitlematchmode",2) if WinActive("Example") Then Else If NOT WinActive("Example") Then sleep(5000) Exit EndIf EndIf EndFunc Edited March 26, 2006 by slightly_abnormal
GaryFrost Posted March 26, 2006 Posted March 26, 2006 #include <GuiConstants.au3> $GUI = GUICreate("Example", 200, 200, -1, -1) GUISetState() $not_Active = 0 AdlibEnable("_keepmouse", 1000) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Sleep(100) EndSelect WEnd Func _keepmouse() Opt("wintitlematchmode", 2) If WinActive("Example") Then $not_Active = 0 Else If Not WinActive("Example") Then $not_Active += 1 If $not_Active = 5 Then Exit EndIf EndIf EndFunc ;==>_keepmouse SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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