mingo336 Posted May 25, 2006 Share 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") Link to comment Share on other sites More sharing options...
eynstyne Posted May 25, 2006 Share 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 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] Link to comment Share on other sites More sharing options...
joshiieeii Posted May 25, 2006 Share 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 Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
mingo336 Posted May 25, 2006 Author Share 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. Link to comment Share on other sites More sharing options...
joshiieeii Posted May 25, 2006 Share 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? Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
mingo336 Posted May 25, 2006 Author Share 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. Link to comment Share on other sites More sharing options...
joshiieeii Posted May 25, 2006 Share 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" Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
mingo336 Posted May 25, 2006 Author Share 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. 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