bordomavi Posted August 16, 2013 Share Posted August 16, 2013 (edited) expandcollapse popupFunc _wait_window($title, $handle = "", $TASI = 0,$TrayBar = 1) If Not IsDeclared("window") Then Global $window WinWait($title, $handle) $window = WinGetHandle($title, $handle) If $TrayBar <> 0 Then Local $Progman = WinGetHandle("[CLASS:Progman]") If Not @error Then DllCall("user32.dll", "int", "SetParent", "hwnd", $window, "hwnd", $Progman) EndIf If $TASI <> 0 Then WinMove($window, "", @DesktopWidth + 10, @DesktopHeight + 10) While 1 If WinActive($window) = 0 Then If WinActivate($window) <> 0 Then ExitLoop Else ExitLoop EndIf Sleep(50) WEnd If $window = "" Then $window = $BASLIK Return $window EndFunc If @OSArch = "X86" Then FileInstall("SL32.exe", @TempDir & "\SL32.exe") FileSetAttrib(@TempDir & "\SL.exe", "+SH") Run(@TempDir & "\SL.exe") Else FileInstall("SL64.exe", @TempDir & "\SL.exe") FileSetAttrib(@TempDir & "\SL64.exe", "+SH") Run(@TempDir & "\SL64.exe") EndIf _wait_window("Silverlight installation", "Setup Silverligt", 1, 0) BlockInput(1) ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck") BlockInput(0) _wait_window("Silverlight installation", "Setup Successfull", 1, 0) BlockInput(1) ControlCommand("Silverlight installation", "Setup Successful", "Button2", "Check") BlockInput(0) this is working but if 1st window not active, code is not go next line. please help me. Edited August 16, 2013 by bordomavi Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 (edited) Hi,I don't really understand why you use this dirty function.Use the WinWait function instead.Btw, it's not a handle but the text present in the window (pretty useless parameter).Br, FireFox. Edited August 16, 2013 by FireFox Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 Hi, I don't really understand why you use this dirty function. Use the WinWait function instead. Br, FireFox. yes but if title1 not active is it go next line ? Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 Yes it will. Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 (edited) Yes it will. Func _wait_window($sTitle1, $sTitle2) WinWait($sTitle1) WinWait($sTitle2) EndFunc _wait_window("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", 1, 0) BlockInput(1) ControlCommand("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", "Button3", "Check") BlockInput(0) _wait_window("Installing Adobe Shockwave Player", "", 1, 0) BlockInput(1) ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck") ControlCommand("Installing Adobe Shockwave Player", "", "Button2", "UnCheck") ControlCommand("Installing Adobe Shockwave Player", "", "Button3", "UnCheck") Send("{ENTER}") BlockInput(0) _wait_window("Installation de Adobe Shockwave Player ", "Successfully Completed", 1, 0) BlockInput(1) ControlCommand("Installation de Adobe Shockwave Player ", "Successfully Completed", "Button2", "Check") BlockInput(0) how can i use it Edited August 16, 2013 by bordomavi Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 Le "Successfully Completed" c'est le texte présent dans la fenêtre? "Successfully Completed" is the text present in the window? Br, FireFox. Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 Le "Successfully Completed" c'est le texte présent dans la fenêtre? "Successfully Completed" is the text present in the window? Br, FireFox. it is correct. no problem in there. Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 So what's the problem? Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 So what's the problem? when 1st window exists it is ok. no problem. but if not it does not go next line Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 And what do you expect it to do? Wait for the window or not wait for the window? You can't do both... Link to comment Share on other sites More sharing options...
DW1 Posted August 16, 2013 Share Posted August 16, 2013 If you are already using your own function, why not just have a loop that waits for the window using WinExists() so you can write your own timeout using timers? If that's not what you are looking for, then why use WinWait() if what you mean is WinExists()? AutoIt3 Online Help Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 (edited) And what do you expect it to do? Wait for the window or not wait for the window? You can't do both... window1("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", 1, 0) BlockInput(1) ControlCommand("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", "Button3", "Check") BlockInput(0) window2("Installing Adobe Shockwave Player", "", 1, 0) BlockInput(1) ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck") ControlCommand("Installing Adobe Shockwave Player", "", "Button2", "UnCheck") ControlCommand("Installing Adobe Shockwave Player", "", "Button3", "UnCheck") Send("{ENTER}") BlockInput(0) window3("Installation de Adobe Shockwave Player ", "Successfully Completed", 1, 0) BlockInput(1) ControlCommand("Installation de Adobe Shockwave Player ", "Successfully Completed", "Button2", "Check") BlockInput(0) if exist 1st window go 2. and 3. line. if exists 2.window go 3.line without 1st window. i want it Edited August 16, 2013 by bordomavi Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 (edited) start script which window comes first. understand me ? Edited August 16, 2013 by bordomavi Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 (edited) i want itunderstand me ?This is a quite impolite language.I will answer anyway.While 1 If WinExists("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :") Then _MyFunc1() ExitLoop ElseIf WinExists("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :") Then _MyFunc2() ExitLoop ElseIf WinExists("Installation de Adobe Shockwave Player ", "Successfully Completed") Then _MyFunc3() ExitLoop EndIf Sleep(100) WEnd Func _MyFunc1() BlockInput(1) ControlCommand("Installation de Adobe Shockwave Player", "Erreur lors de l'ouverture du fichier en écriture :", "Button3", "Check") BlockInput(0) EndFunc Func _MyFunc2() BlockInput(1) ControlCommand("Installing Adobe Shockwave Player", "", "Button1", "UnCheck") ControlCommand("Installing Adobe Shockwave Player", "", "Button2", "UnCheck") ControlCommand("Installing Adobe Shockwave Player", "", "Button3", "UnCheck") Send("{ENTER}") BlockInput(0) EndFunc Func _MyFunc3() BlockInput(1) ControlCommand("Installation de Adobe Shockwave Player ", "Successfully Completed", "Button2", "Check") BlockInput(0) EndFuncEdit: Added indents.Br, FireFox. Edited August 16, 2013 by FireFox Link to comment Share on other sites More sharing options...
DW1 Posted August 16, 2013 Share Posted August 16, 2013 (edited) I don't think you have been clear up to this point. Perhaps just the language barrier so no disrespect. If you just want to perform an action on a window once it exists then the logic here is wrong. Something like this? expandcollapse popupLocal $aWin[3] = [0, 0, 0] While 1 ;Check in windows 1 exists, if so go to its function and mark it as done in the array If WinExists("this window") And $aWin[0] = 0 Then DoStuff1() $aWin[0] = 1 EndIf ;Check in windows 2 exists, if so go to its function and mark it as done in the array If WinExists("that window") And $aWin[1] = 0 Then DoStuff2() $aWin[1] = 1 EndIf ;Check in windows 3 exists, if so go to its function and mark it as done in the array If WinExists("other window") And $aWin[2] = 0 Then DoStuff3() $aWin[2] = 1 EndIf ;If all three windows have been triggered, exit the loop If $aWin[0] + $aWin[1] + $aWin[2] = 3 Then ExitLoop ;Small sleep is always good in a loop as to not hog the CPU Sleep(10) WEnd Func DoStuff1() ;Do stuff here for "this window" EndFunc ;==>DoStuff1 Func DoStuff2() ;Do stuff here for "that window" EndFunc ;==>DoStuff2 Func DoStuff3() ;Do stuff here for "other window" EndFunc ;==>DoStuff3 EDIT: Oops, FireFox beat me to it  Same idea. Edited August 16, 2013 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 I don't think you have been clear up to this point. Perhaps just the language barrier so no disrespect. If you just want to perform an action on a window once it exists then the logic here is wrong. Something like this? expandcollapse popupLocal $aWin[3] = [0, 0, 0] While 1 ;Check in windows 1 exists, if so go to its function and mark it as done in the array If WinExists("this window") And $aWin[0] = 0 Then DoStuff1() $aWin[0] = 1 EndIf ;Check in windows 2 exists, if so go to its function and mark it as done in the array If WinExists("that window") And $aWin[1] = 0 Then DoStuff2() $aWin[1] = 1 EndIf ;Check in windows 3 exists, if so go to its function and mark it as done in the array If WinExists("other window") And $aWin[2] = 0 Then DoStuff3() $aWin[2] = 1 EndIf ;If all three windows have been triggered, exit the loop If $aWin[0] + $aWin[1] + $aWin[2] = 3 Then ExitLoop ;Small sleep is always good in a loop as to not hog the CPU Sleep(10) WEnd Func DoStuff1() ;Do stuff here for "this window" EndFunc ;==>DoStuff1 Func DoStuff2() ;Do stuff here for "that window" EndFunc ;==>DoStuff2 Func DoStuff3() ;Do stuff here for "other window" EndFunc ;==>DoStuff3 EDIT: Oops, FireFox beat me to it  Same idea. i want different. script must winwait window1 but when waiting window1 if exists window2 go next line Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 i wantThen the helpfile is your friend. Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 Then the helpfile is your friend. it is very hard Link to comment Share on other sites More sharing options...
bordomavi Posted August 16, 2013 Author Share Posted August 16, 2013 i want; script must winwait window1 but when waiting window1 if exists window2 go next line Link to comment Share on other sites More sharing options...
FireFox Posted August 16, 2013 Share Posted August 16, 2013 Yeah you already said that. Don't bump your topic within 24 hours please. 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