pjw73nh Posted May 16, 2007 Share Posted May 16, 2007 Greetings, I am very new to scripting so please bear with me. See my code below. I have troubleshot this using MSGBox and have determined that the script does not recognize the window titles that appear between the "this is the code that should be used if the user has IE SP1" and "end conditional code commented lines". It acts is if neither of the windows ever exists during execution, and I know they do. I have verified the spelling as well. I don't know why the WinActive and WinWaitActive lines don't recognize the respective windows when they appear. I have used AU3info.exe and it in fact displays the correct window titles. What I am trying to do is to send a specific keystroke, depending on which window displays. Any other thoughts or suggestions would be appreciated. Thanks Paul... AutoItSetOption("WinTitleMatchMode", 1) ;Determine if Kronos Java Client is already installed If FileExists("C:\Program Files\java\jre1.5.0_06") Then MsgBox(4160, "Update Not Needed", "You already have the correct version of Java to run KRONOS") Exit EndIf ; Sub-routine to run the install. MsgBox(64, "Install Java 1.5.0 U6 for Kronos", "Click OK to install JRE 1.5.0 update 6 for Kronos") Run("C:\Program Files\Internet Explorer\iexplore.exe http:\\ehkronosapp\wfc\logon") ;BlockInput(1) ;*********** this is the code that should be used if the user has IE SP1 ****************** If WinActive("Security Warning") Then WinWaitActive("Security Warning") Send("!y") ;*********** this is the code that should be used if the user has IE SP2 ****************** ElseIf WinActive("Internet Explorer - Security Warning") Then WinWaitActive("Internet Explorer - Security Warning") Send("!i") EndIf ;**************** End conditional code *********************** WinWaitActive("J2SE Runtime Environment 5.0 Update 6 - License") Send("!a") WinWaitActive("J2SE Runtime Environment 5.0 Update 6 - Complete") ;BlockInput(0) Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 16, 2007 Share Posted May 16, 2007 I think you are checking for WinActive() way too fast after the Run(). That check will occur in microseconds and the window just may not pop up that fast. Try this: While 1 If WinExists("Security Warning") Then ;*********** this is the code that should be used if the user has IE SP1 ****************** WinActivate("Security Warning") WinWaitActive("Security Warning") Send("!y") ExitLoop ElseIf WinExists("Internet Explorer - Security Warning") Then ;*********** this is the code that should be used if the user has IE SP2 ****************** WinActivate("Internet Explorer - Security Warning") WinWaitActive("Internet Explorer - Security Warning") Send("!i") ExitLoop EndIf WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
pjw73nh Posted May 17, 2007 Author Share Posted May 17, 2007 PsaltyDS, Thanks for the help, this works great. I must confess though, that just prior to checking back in the forum here, I was diligently working on a solution. I FINALLY found out that, that is exactly what was happening. The script was running WAY too fast. My solution (up to now) was to put a Sleep (7000) line it, this gave the app enough time to display the window. I have since subtituted your "while" sub and it works great. I Learn something new everytime I post. Thanks. Thanks for the help. I really appreciate it. Paul ... I think you are checking for WinActive() way too fast after the Run(). That check will occur in microseconds and the window just may not pop up that fast. Try this: While 1 If WinExists("Security Warning") Then ;*********** this is the code that should be used if the user has IE SP1 ****************** WinActivate("Security Warning") WinWaitActive("Security Warning") Send("!y") ExitLoop ElseIf WinExists("Internet Explorer - Security Warning") Then ;*********** this is the code that should be used if the user has IE SP2 ****************** WinActivate("Internet Explorer - Security Warning") WinWaitActive("Internet Explorer - Security Warning") Send("!i") ExitLoop EndIf WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 17, 2007 Share Posted May 17, 2007 PsaltyDS,Thanks for the help, this works great. I must confess though, that just prior to checking back in the forum here, I was diligently working on a solution. I FINALLY found out that, that is exactly what was happening. The script was running WAY too fast. My solution (up to now) was to put a Sleep (7000) line it, this gave the app enough time to display the window. I have since subtituted your "while" sub and it works great. I Learn something new everytime I post. Thanks. Thanks for the help. I really appreciate it. Paul ...You're welcome. I learn something every time I read questions and think about the issues of other users like yourself. A big part of what makes AutoIt great is the community supporting it.Cheers! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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