sfunk1x Posted September 19, 2005 Share Posted September 19, 2005 Hey all - I'm trying to write an automated installation script for an app that I want to automate testing of. I'm running into an issue though - the app requires .NET 1.1 framework. Ok, I added the code to control automated installation of this, but my problem is this: Sometimes the machines have .NET 1.1 framework. Some don't. I added some lines of code to try to differentiate between machines that have it vs those that don't. Installshield will recognize whether or not it exists and send the user down a seperate pathway for the .NET installation. My issue appears to be getting the script to recognize that the .NET install has occured. This is the code snippet I'm dealing with: -------------------------- Select Case WinExists ("InstallShield Wizard", "Configuring Microsoft® .NET Framework") WinWaitActive ("Microsoft .NET Framework 1.1 Setup") ControlClick ("Microsoft .NET Framework 1.1 Setup", "I &agree", "Button3", "left") ControlClick ("Microsoft .NET Framework 1.1 Setup", "&Install", "Button4", "left") WinWaitActive ("Microsoft .NET Framework 1.1 Setup", "Installation of Microsoft .NET Framework 1.1 is complete.") ControlClick ("Microsoft .NET Framework 1.1 Setup", "OK", "Button1", "left") Case WinExists ("********* - Setup") WinWait("********* - Setup") WinActivate("********* - Setup") Sleep(3000) ControlClick("********* - Setup", "&Next >", "Button1", "left") ControlClick("********* - Setup", "I &do not accept the terms in the license agreement", "Button3", "left") ControlClick("********* - Setup", "I &do not accept the terms in the license agreement", "Button5", "left") ControlClick("********* - Setup", "&Typical", "Button6", "left") WinWait("********* - Setup") ControlClick("********* - Setup", "&Install", "Button1", "left") EndSelect ------------------------- I think some of the issue is because the first line of code where you see "Configuring Microsoft® .NET Framework" because that exact phrase does not appear immedaitely, it will appear after a few seconds on a slower machine because Installshield is determining the dependencies of the app - namely whether or not .NET is installed. But if I change it back to normal, would it not be too close to what it would be originally, therefore pushing it off into the portion of the script that installs the app, negating it's ability to go throught he .NET installation? This probably sounds very confusing, but if anyone can help me I can probably un-confuse you Thanx in advance! Link to comment Share on other sites More sharing options...
seandisanti Posted September 19, 2005 Share Posted September 19, 2005 ControlClick("********* - Setup", "I &do not accept the terms in the license agreement", "Button5", "left")wouldn't this cancel your install? Link to comment Share on other sites More sharing options...
sfunk1x Posted September 19, 2005 Author Share Posted September 19, 2005 No, actually it doesn't. The text in the middle is just text for that particular window, and doesn't represent the button it's actually clicking. I may actually not even need it there, but it executes properly anyway.Thanks for lookin' out for me Link to comment Share on other sites More sharing options...
seandisanti Posted September 19, 2005 Share Posted September 19, 2005 No, actually it doesn't. The text in the middle is just text for that particular window, and doesn't represent the button it's actually clicking. I may actually not even need it there, but it executes properly anyway.Thanks for lookin' out for me no problem. ok back to the issue. sorry i was a little confused by your first explanation, but do want to help. what is the problem behavior your script is actually exhibiting? is it not recognizing a window? is it not continuing when it should? Link to comment Share on other sites More sharing options...
sfunk1x Posted September 19, 2005 Author Share Posted September 19, 2005 no problem. ok back to the issue. sorry i was a little confused by your first explanation, but do want to help. what is the problem behavior your script is actually exhibiting? is it not recognizing a window? is it not continuing when it should?Not continuing when it should, basically. It is getting confused I think because I (believe) am not using the Select/Case sequence properly.Basically, I'd like to script to recognize that this particular path is being taken because .NET doesn't exist on the system. Another method my attention was brought to would be to check the file system to see if .NET exists, which would be another excellent way to do it, but I am unsure of how to bypass certain code and move onto other bits... for example:If FileExists("Blahblah.NETFolder") then ???? Else <run through .NET installation>How would I get that THEN statement to run through the app installation code later on in the script, and bypass all the .NET installation code?Let me know if I'm being unclear. Sounds kind of loopy to me, but maybe you can understand my gibberish Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted September 19, 2005 Share Posted September 19, 2005 One way is to code if .Net doesn't exist, and then install everything else regardless If Not FileExists("dotNetFile.txt") Then ;Commands to Install .Net EndIf ;Commands to install program on all computers Also, WinGetText works nicely, that way you don't have to assume that .Net is installed or not (just do a StringInStr comparison) Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
jefhal Posted September 19, 2005 Share Posted September 19, 2005 (edited) One way is to code if .Net doesn't exist, and then install everything else regardlessYou can check for the existence of the folder: C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705 or something like that: "C:\" & @windowsdir & "\Microsoft.NET\Framework\v" to test if .net is installed. Edited September 19, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
sfunk1x Posted September 20, 2005 Author Share Posted September 20, 2005 (edited) OK, so I implemented the If NOT FileExists/EndIf statement, but now it seems as if it starts executing the If NOT statement, and as soon as it launches the .NET installer, it jumps out of the If/EndIf statement and starts executing the other code that installs the app. Am I missing something? -------------- If NOT FileExists("C:\" & @WindowsDir & "\Microsoft.NET\Framework\v1.1.4322") Then Run("T:\Setup\1033dotnetfx.exe") WinWait("Microsoft .NET Framework 1.1 Setup") WinActivate("Microsoft .NET Framework 1.1 Setup") ControlClick("Microsoft .NET Framework 1.1 Setup", "&Yes", "Button1", "left") WinWait("Microsoft .NET Framework 1.1 Setup", "") ControlClick("Microsoft .NET Framework 1.1 Setup", "I &agree", "Button3", "left") ControlClick("Microsoft .NET Framework 1.1 Setup", "&Install", "Button4", "left") WinWait("Microsoft .NET Framework 1.1 Setup", "") ControlClick("Microsoft .NET Framework 1.1 Setup", "OK", "Button1", "left") EndIf ; Installation Start Run("T:\setup.exe") WinWait("*******") WinActivate("*******") Sleep(1500) ControlClick("*******", "&Next >", "Button1", "left") ControlClick("*******", "I &do not accept the terms in the license agreement", "Button3", "left") ControlClick("*******", "I &do not accept the terms in the license agreement", "Button5", "left") ControlClick("*******", "&Typical", "Button6", "left") WinWait("*******") ControlClick("*******", "&Install", "Button1", "left") Edited September 20, 2005 by sfunk1x Link to comment Share on other sites More sharing options...
Valuater Posted September 20, 2005 Share Posted September 20, 2005 change this If NOT FileExists("C:\" & @WindowsDir & "\Microsoft.NET\Framework\v1.1.4322") Then to this If NOT FileExists( @WindowsDir & "\Microsoft.NET\Framework\v1.1.4322") Then that was an improper format 8) Link to comment Share on other sites More sharing options...
sfunk1x Posted September 20, 2005 Author Share Posted September 20, 2005 (edited) Thanks for pointing that out. Now it runs the check for .NET properly (was launching the installer regardless).. but, I'm still having the problem of it executing the code outside the If/EndIf statement before the .NET installer is finished doing it's thing. I tried ProcessWaitClose, but the problem then is that it immediately jumps through all that other code and waits until the process finishes, and of course it never finishes because it requires user input that I placed code above the ProcessWaitClose statement for... I also tried placing ProcessWaitClose inside the If statement, and just before the rest of the App install code, but it doesn't seem to make a difference. Edited September 20, 2005 by sfunk1x Link to comment Share on other sites More sharing options...
Valuater Posted September 20, 2005 Share Posted September 20, 2005 Thanks for pointing that out. Now it runs the check for .NET properly (was launching the installer regardless).. but, I'm still having the problem of it executing the code outside the If/EndIf statement before the .NET installer is finished doing it's thing.I tried ProcessWaitClose, but the problem then is that it immediately jumps through all that other code and waits until the process finishes, and of course it never finishes because it requires user input that I placed code above the ProcessWaitClose statement for... I also tried placing ProcessWaitClose inside the If statement, and just before the rest of the App install code, but it doesn't seem to make a difference.there is not enough code here to help you with that8) Link to comment Share on other sites More sharing options...
sfunk1x Posted September 20, 2005 Author Share Posted September 20, 2005 (edited) Here is the script in it's entirety. The portion with the If NOT statement installs the .NET framework. All the code after the EndIf deals with automating the install and web registration of the application. TIA! ----------------------------------------------- ; Debug line, remove after finalization Opt("Trayicondebug",1) ; Script Start ;------------- ;Drive Mapping in preparation of install - This will have the effect of launching autorun for *** as well. drivemapadd("T:", "\\bluebird\E", 8, "sean", "sean") ; .NET 1.1 installation check begins If NOT FileExists( @WindowsDir & "\Microsoft.NET\Framework\v1.1.4322") Then Run("T:\Setup\1033dotnetfx.exe /q") ControlClick("Microsoft .NET Framework 1.1 Setup", "I &agree", "Button3", "left") ControlClick("Microsoft .NET Framework 1.1 Setup", "&Install", "Button4", "left") WinWait("Microsoft .NET Framework 1.1 Setup", "") ControlClick("Microsoft .NET Framework 1.1 Setup", "OK", "Button1", "left") EndIf ; Installation Start Run("T:\setup.exe") WinWait("********* - Setup") WinActivate("********* - Setup") Sleep(1500) ControlClick("********* - Setup", "&Next >", "Button1", "left") ControlClick("********* - Setup", "I &do not accept the terms in the license agreement", "Button3", "left") ControlClick("********* - Setup", "I &do not accept the terms in the license agreement", "Button5", "left") ControlClick("********* - Setup", "&Typical", "Button6", "left") WinWait("********* - Setup") ControlClick("********* - Setup", "&Install", "Button1", "left") ; The installation has been started and the user will be prompted to ; register the software. This script will register as a person outside ; the US. WinWait("********* Registration") Sleep(3000) ControlClick("********* Registration", "13 or Older", "Button2", "left") WinWait("********* Registration") Sleep(3000) ControlClick("********* Registration", "Quit", "Button1", "left") Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("********* Registration","") If Not WinActive("********* Registration","") Then WinActivate("********* Registration","") ;WinWaitActive("********* Registration","") MouseMove(48,57) MouseDown("left") MouseUp("left") Sleep(1000) MouseMove(626,475) MouseDown("left") MouseUp("left") ; The final installation screen will now be shown and handled by the script. WinWait("*********® - Microsoft Internet Explorer","") WinClose("*********® - Microsoft Internet Explorer","") WinWait("********* - Setup","") If Not WinActive("********* - Setup","") Then WinActivate("********* - Setup","") EndIf Sleep(1500) ControlClick("********* - Setup", "&Finish", "Button1", "left") ; Removal of script mapped drive(s) DriveMapDel("E:") Edited September 20, 2005 by sfunk1x Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2005 Share Posted September 21, 2005 maybe if processexists().... then processwaitclose() 8) Link to comment Share on other sites More sharing options...
sfunk1x Posted September 21, 2005 Author Share Posted September 21, 2005 Ugh, I was dumb. A good nights rest and a milkshake helped me that my wait statements were both commented out and didn't exist properly. Once those were taken car eof, the issues were resolved. Fully functional script with a check for .NET installation now! So, the framework is now complete thanks to several people who helped me debug, and I'm onto broader and better projects with AutoIt :-) Thanks again! Link to comment Share on other sites More sharing options...
Valuater Posted September 21, 2005 Share Posted September 21, 2005 Cool 8) 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