mingo336 0 Posted May 25, 2006 I am trying to write a script that looks for the existance of a specific window and then returns a exit code of 1 or O based on if the window is open or not. With my limited knowledge I wrote this but it allways returns a zero regardless of if the Calculator window is open or not. What am I doing wrong? ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: John Lutz johnlutz@gmail.com ; ; Script Function: ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here WinExists("Calculator") Share this post Link to post Share on other sites
eynstyne 1 Posted May 25, 2006 I did this and got a 1 $win = winexists("Calculator") msgbox(0,"",$win) i'm not sure what you're doing wrong Hide eynstyne's signature Hide all signatures F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent] Share this post Link to post Share on other sites
joshiieeii 0 Posted May 25, 2006 I am trying to write a script that looks for the existance of a specific window and then returns a exit code of 1 or O based on if the window is open or not. With my limited knowledge I wrote this but it allways returns a zero regardless of if the Calculator window is open or not. What am I doing wrong? ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: John Lutz johnlutz@gmail.com ; ; Script Function: ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here WinExists("Calculator")You have to put an argument to check if the window exists, as you have it now, it is not really doing anything, check the autoit help file, it has tons of examples. You are probably wanting to do something like this: if ProcessExists ( "calc.exe" )Then MsgBox(0, "", "Calculator Found") Else MsgBox(0, "", "NO Calculator Found") EndIf Hide joshiieeii's signature Hide all signatures Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Share this post Link to post Share on other sites
mingo336 0 Posted May 25, 2006 Right, I can make that work too. I don't want the message box though. I just want it to check for the window and then generate the appropriate exit code. Share this post Link to post Share on other sites
joshiieeii 0 Posted May 25, 2006 Right, I can make that work too. I don't want the message box though. I just want it to check for the window and then generate the appropriate exit code.Well, I don't think the calculator is a good example, what are you really trying to check, IE window, or an application window? Hide joshiieeii's signature Hide all signatures Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Share this post Link to post Share on other sites
mingo336 0 Posted May 25, 2006 An application window. I didn't know it made a difference. I was using the calculator becuase it was easy to test with. Share this post Link to post Share on other sites
joshiieeii 0 Posted May 25, 2006 An application window. I didn't know it made a difference. I was using the calculator becuase it was easy to test with.If its an application, are you just trying to see if its running or a specific part (window) of the application?If you are just wanting to see if the app is running, you could use "Processexists" Hide joshiieeii's signature Hide all signatures Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Share this post Link to post Share on other sites
mingo336 0 Posted May 25, 2006 My problem is I have an application that throws up error messages running under the same process. So I cannot differentiate between the active process and the error message. However, their window names are different. Share this post Link to post Share on other sites