komalo Posted August 29, 2008 Share Posted August 29, 2008 hi i tried to pause script until any window in the screen is opened but the problem is that the script isn't paused when calling it again that's my script expandcollapse popup#NoTrayIcon HotKeySet("{ESC}", "_Exit") Winwaitnew() MsgBox("","",1) Winwaitnew() MsgBox("","",2) Func CompareList($List1, $List2) For $i = 1 To $List1[0][0] If $List1[$i][0] <> "" And BitAND(WinGetState($List1[$i][1]), 2) Then $List1N = $List1N + 1 Next For $i = 1 To $List2[0][0] If $List2[$i][0] <> "" And BitAND(WinGetState($List2[$i][1]), 2) Then $List2N = $List2N + 1 Next If $List1N <> $List2N Then $List1N=0 $List2N=0 Return 1 Else $List1N=0 $List2N=0 Return 0 EndIf EndFunc ;==>CompareList Func _Exit() Exit EndFunc ;==>_Exit Func Winwaitnew() Local $ConstWin,$NewList $ConstWin = WinList() Do $NewList = WinList() Sleep(1) Until CompareList($ConstWin, $NewList) = 1 EndFunc [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
Zedna Posted August 29, 2008 Share Posted August 29, 2008 (edited) #NoTrayIcon HotKeySet("{ESC}", "_Exit") Winwaitnew() MsgBox("","",1) Winwaitnew() MsgBox("","",2) ... #NoTrayIcon HotKeySet("{ESC}", "_Exit") While 1 Winwaitnew() MsgBox("","",1) Sleep(100) WEnd ... Edited August 29, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
komalo Posted August 30, 2008 Author Share Posted August 30, 2008 #NoTrayIcon HotKeySet("{ESC}", "_Exit") While 1 Winwaitnew() MsgBox("","",1) Sleep(100) WEnd ...i know how to write a loop , i made it in the function that's not what i asked about , try the code i wrote and you will notice that the 2nd msgbox appears without waiting a new window , if just there was a function that waits in autoit until any new window appear too bad that WinWait don't do that [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
BrettF Posted August 30, 2008 Share Posted August 30, 2008 (edited) Will this worked... expandcollapse popup#NoTrayIcon $List1N = 0 $List2N = 0 HotKeySet("{ESC}", "_Exit") While 1 Winwaitnew() MsgBox(0,"","New Window Detected") WEnd Func CompareList($List1, $List2) For $i = 1 To $List1[0][0] If $List1[$i][0] <> "" And BitAND(WinGetState($List1[$i][1]), 2) Then $List1N = $List1N + 1 Next For $i = 1 To $List2[0][0] If $List2[$i][0] <> "" And BitAND(WinGetState($List2[$i][1]), 2) Then $List2N = $List2N + 1 Next If $List1N <> $List2N Then $List1N=0 $List2N=0 Return 1 Else $List1N=0 $List2N=0 Return 0 EndIf EndFunc ;==>CompareList Func _Exit() Exit EndFunc ;==>_Exit Func Winwaitnew() Local $ConstWin,$NewList $ConstWin = WinList() Do $NewList = WinList() Sleep(1) Until CompareList($ConstWin, $NewList) = 1 EndFunc Can't see what your problem is... Edited August 30, 2008 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
komalo Posted August 30, 2008 Author Share Posted August 30, 2008 Replace this MsgBox(0,"","New Window Detected") with a run function to any program but i warn you because it will crashes your memory unless you press ESC (Exit) [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
komalo Posted August 30, 2008 Author Share Posted August 30, 2008 any one ? [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
BrettF Posted August 31, 2008 Share Posted August 31, 2008 Well that will open an infinate number of new windows You need to add a way of excluding the new window in the search. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
martin Posted August 31, 2008 Share Posted August 31, 2008 hi i tried to pause script until any window in the screen is opened but the problem is that the script isn't paused when calling it again that's my script expandcollapse popup#NoTrayIcon HotKeySet("{ESC}", "_Exit") Winwaitnew() MsgBox("","",1) Winwaitnew() MsgBox("","",2) Func CompareList($List1, $List2) For $i = 1 To $List1[0][0] If $List1[$i][0] <> "" And BitAND(WinGetState($List1[$i][1]), 2) Then $List1N = $List1N + 1 Next For $i = 1 To $List2[0][0] If $List2[$i][0] <> "" And BitAND(WinGetState($List2[$i][1]), 2) Then $List2N = $List2N + 1 Next If $List1N <> $List2N Then $List1N=0 $List2N=0 Return 1 Else $List1N=0 $List2N=0 Return 0 EndIf EndFunc ;==>CompareList Func _Exit() Exit EndFunc ;==>_Exit Func Winwaitnew() Local $ConstWin,$NewList $ConstWin = WinList() Do $NewList = WinList() Sleep(1) Until CompareList($ConstWin, $NewList) = 1 EndFuncIf the variables $List1N and $List2N are made Local variables in CompareList then the WInWaitNEw function doesn't wait for a new window, it waits untill the number of windows changes. To make it reliable I think you should make $Lit1N to be a list of of the handles for visible windows, and then if $Newlist contains a handle of a window that isn't in the $List1n then say it's a new window. Like this expandcollapse popup#NoTrayIcon HotKeySet("{ESC}", "_Exit") While 1 MsgBox("", "", Winwaitnew()) WEnd Func CompareList($List1, $List2) Local $List1N = "|" For $i = 1 To $List1[0][0] If $List1[$i][0] <> "" And BitAND(WinGetState($List1[$i][1]), 2) Then $List1N &= $List1[$i][1] & "|" Next For $i = 1 To $List2[0][0] If $List2[$i][0] <> "" And BitAND(WinGetState($List2[$i][1]), 2) Then $search = "|" & $List2[$i][1] & "|" If Not StringInStr($List1N, $search) And $List2[$i][0] <> "start menu" Then Return $List2[$i][0] EndIf Next Return "" EndFunc ;==>CompareList Func _Exit() Exit EndFunc ;==>_Exit Func Winwaitnew() Local $ConstWin, $NewList $ConstWin = WinList() Do $NewList = WinList() Sleep(100) $Reply = CompareList($ConstWin, $NewList) Until $Reply <> "" Return $Reply EndFunc ;==>Winwaitnew 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...
komalo Posted August 31, 2008 Author Share Posted August 31, 2008 If the variables $List1N and $List2N are made Local variables in CompareList then the WInWaitNEw function doesn't wait for a new window, it waits untill the number of windows changes. To make it reliable I think you should make $Lit1N to be a list of of the handles for visible windows, and then if $Newlist contains a handle of a window that isn't in the $List1n then say it's a new window. Like this expandcollapse popup#NoTrayIcon HotKeySet("{ESC}", "_Exit") While 1 MsgBox("", "", Winwaitnew()) WEnd Func CompareList($List1, $List2) Local $List1N = "|" For $i = 1 To $List1[0][0] If $List1[$i][0] <> "" And BitAND(WinGetState($List1[$i][1]), 2) Then $List1N &= $List1[$i][1] & "|" Next For $i = 1 To $List2[0][0] If $List2[$i][0] <> "" And BitAND(WinGetState($List2[$i][1]), 2) Then $search = "|" & $List2[$i][1] & "|" If Not StringInStr($List1N, $search) And $List2[$i][0] <> "start menu" Then Return $List2[$i][0] EndIf Next Return "" EndFunc ;==>CompareList Func _Exit() Exit EndFunc ;==>_Exit Func Winwaitnew() Local $ConstWin, $NewList $ConstWin = WinList() Do $NewList = WinList() Sleep(100) $Reply = CompareList($ConstWin, $NewList) Until $Reply <> "" Return $Reply EndFunc ;==>Winwaitnew thank you , it wasn't that ,i got it work the problem that i had to use WinWaitNotActive thank you all [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] 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