KluYa Posted March 15, 2010 Share Posted March 15, 2010 Hi all, I am trying to use autoit to install multiple applications, one after the other. A problem I am having is that after I've installed Adobe Acrobat 9.0 , my script then opens the program and makes a few changes to settings. While this part of the script is running, the next program starts installing before acrobat is finished. Any suggestions would be appreciated. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 15, 2010 Share Posted March 15, 2010 Post your script. Help others to help you. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
KluYa Posted March 15, 2010 Author Share Posted March 15, 2010 Here is the first few lines from the master installer script. ; Install AVG 9 #include "C:\installfiles\avg\install.au3" sleep(2000) ; Install Acrobat #include "C:\installfiles\AcrobatReader\install.au3" sleep(2000) ; Install CCleaner #include "C:\installfiles\CClearner\install.au3" sleep(2000) Here's the code from the Adobe Reader script. run("C:\installfiles\AcrobatReader\AdbeRdr920_en_US.exe") WinWaitActive("Adobe Reader 9.2 - Setup","Click Next to install to this folder") send("!n") WinWaitActive("Adobe Reader 9.2 - Setup","If you want to review or change any of your installation") send("!i") WinWaitActive("Adobe Reader 9.2 - Setup","Setup has successfully installed Adobe Reader 9.2") send("!f") ; Start Acrobat, Accept EULA and close run("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe") WinWaitActive("Adobe Reader - License Agreement","Press the Accept button to agree to the License Agreement") ControlClick("Adobe Reader - License Agreement","Press the Accept button to agree to the License Agreement",1) WinWaitActive("Adobe Reader","") send("!{F4}") And here is the code from the next program's script. Run('C:\installfiles\CClearner\ccsetup228.exe') WinWait("Installer Language","Please select a lang") If Not WinActive("Installer Language","Please select a lang") Then WinActivate("Installer Language","Please select a lang") WinWaitActive("Installer Language","Please select a lang") Send("{ENTER}") WinWait("CCleaner v2.28 Setup","Welcome to the CClea") If Not WinActive("CCleaner v2.28 Setup","Welcome to the CClea") Then WinActivate("CCleaner v2.28 Setup","Welcome to the CClea") WinWaitActive("CCleaner v2.28 Setup","Welcome to the CClea") Send("{ALTDOWN}n{ALTUP}") WinWait("CCleaner v2.28 Setup ","Please review the li") If Not WinActive("CCleaner v2.28 Setup ","Please review the li") Then WinActivate("CCleaner v2.28 Setup ","Please review the li") WinWaitActive("CCleaner v2.28 Setup ","Please review the li") Send("{ALTDOWN}a{ALTUP}") WinWait("CCleaner v2.28 Setup ","Choose Install Locat") If Not WinActive("CCleaner v2.28 Setup ","Choose Install Locat") Then WinActivate("CCleaner v2.28 Setup ","Choose Install Locat") WinWaitActive("CCleaner v2.28 Setup ","Choose Install Locat") Send("{ALTDOWN}n{ALTUP}") WinWait("CCleaner v2.28 Setup","Select any additiona") If Not WinActive("CCleaner v2.28 Setup","Select any additiona") Then WinActivate("CCleaner v2.28 Setup","Select any additiona") WinWaitActive("CCleaner v2.28 Setup","Select any additiona") Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{TAB}{SPACE}{ALTDOWN}i{ALTUP}") WinWait("CCleaner v2.28 Setup ","Completing the CClea") If Not WinActive("CCleaner v2.28 Setup ","Completing the CClea") Then WinActivate("CCleaner v2.28 Setup ","Completing the CClea") WinWaitActive("CCleaner v2.28 Setup ","Completing the CClea") Send("{SPACE}{ALTDOWN}f{ALTUP}") Link to comment Share on other sites More sharing options...
omikron48 Posted March 15, 2010 Share Posted March 15, 2010 Make a launcher script which calls the installation scripts sequentially via RunWait. That's how I did mine and it's doing fine. Link to comment Share on other sites More sharing options...
MHz Posted March 15, 2010 Share Posted March 15, 2010 Welcome KluYa, I guess your question is how to allow only 1 installation at a time included within the same script? Use ProcessWaitClose() to prevent your script from continuing until the process has finished. Example: $pid = Run('path\to\file1.exe') ; automation code ProcessWaitClose($pid) $pid = Run('path\to\file2.exe') ; automation code ProcessWaitClose($pid) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2010 Moderators Share Posted March 15, 2010 Welcome KluYa, I guess your question is how to allow only 1 installation at a time included within the same script? Use ProcessWaitClose() to prevent your script from continuing until the process has finished. Example: $pid = Run('path\to\file1.exe') ; automation code ProcessWaitClose($pid) $pid = Run('path\to\file2.exe') ; automation code ProcessWaitClose($pid) Or RunWait() if you want to avoid the extra line of code. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dani Posted March 15, 2010 Share Posted March 15, 2010 Well, as RunWait pauses execution while the program is running the ; automation code in Mhz' code wouldn't run when you use RunWait. So in that case it's not likely you want to use RunWait, or am I missing something ? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 15, 2010 Moderators Share Posted March 15, 2010 Well, as RunWait pauses execution while the program is running the ; automation code in Mhz' code wouldn't run when you use RunWait. So in that case it's not likely you want to use RunWait, or am I missing something ?This is true. I generally use switches for silent installation, so I don't have any automation code. I over looked his comments in the code itself. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
KluYa Posted March 17, 2010 Author Share Posted March 17, 2010 Thank you all very much, this has been very helpful I was only introduced to this program AutoIt last week so I'm still learning. Link to comment Share on other sites More sharing options...
KluYa Posted March 24, 2010 Author Share Posted March 24, 2010 Ok, so The problem with Adobe Acrobat is fixed but now I'm having the same problem when installing .NET Framework 2.0. Midway through installation of .NET Framework 2.0 the next program tries to install failing because something else is already installing. Here is the script for .NET Framework 2.0 $pid = Run("C:\installfiles\dot net framework 2\dotnetfx2.exe") WinWaitActive("Microsoft .NET Framework 2.0 Setup", "This wizard will guide you") Send("!n") WinWaitActive("Microsoft .NET Framework 2.0 Setup", "End-User License Agreement") Send("!a") Send("!i") WinWaitActive("Microsoft .NET Framework 2.0 Setup", "It is highly recommended that you download") Send("!f") if ProcessExists($pid) Then Do ProcessClose($pid) Until ProcessWaitClose($pid) EndIf ProcessWaitClose($pid) Part of the main script which calls the other ones. ; Install Dot Net 2.0 #include "C:\installfiles\dot net framework 2\install.au3" sleep(2000) ; Installing Dot Net 3.5 last because it needs a reboot ; Install Dot Net 3.5 #include "C:\installfiles\dot net framework 3.5\install.au3" sleep(2000) The next script after .NET Framework 2.0 $pid = Run("C:\installfiles\dot net framework 3.5\dotnetfx35.exe") $title = "Microsoft .NET Framework 3.5 SP1 Setup" $visibletext = "Welcome to Setup" WinWait($title,$visibletext) If Not WinActive($title,$visibletext) Then WinActivate($title,$visibletext) WinWaitActive($title,$visibletext) Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{SPACE}{ALTDOWN}i{ALTUP}") $visibletext = "Microsoft .NET Framework 3.5 SP1 has been installed successfully." WinWait($title,$visibletext) If Not WinActive($title,$visibletext) Then WinActivate($title,$visibletext) WinWaitActive($title,$visibletext) Send("!x") $visibletext = "&Restart Now" WinWait($title,$visibletext) If Not WinActive($title,$visibletext) Then WinActivate($title,$visibletext) WinWaitActive($title,$visibletext) Send("!l") WinWaitActive("Microsoft .NET Framework 3.5 SP1 Setup", "Setup Complete") Send("!x") if ProcessExists($pid) Then Do ProcessClose($pid) Until ProcessWaitClose($pid) EndIf ProcessWaitClose($pid) The problem definitely isn't the next script, as I've tried calling other installers after .NET 2.0 Link to comment Share on other sites More sharing options...
Bert Posted March 24, 2010 Share Posted March 24, 2010 PM sent. I sent you a copy of a multiple install script I use from time to time. Let me know if that works for you. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
MHz Posted March 24, 2010 Share Posted March 24, 2010 Ok, so The problem with Adobe Acrobat is fixed but now I'm having the same problem when installing .NET Framework 2.0. Midway through installation of .NET Framework 2.0 the next program tries to install failing because something else is already installing. Here is the script for .NET Framework 2.0 DotNet 3.5 includes DotNet 2.0 so no need to install DotNet 2.0 from another installer. It is more convenient to use switches with DotNet as no options exist that switches can not handle. These switches used should hopefully help to make it easier to install the programs. I do not use AVG or Adobe Reader so cannot verify what my searches found. You may want to check out Identify Installer in SendToA3X for finding switches for any other installers that you may have. ; in C:\installfiles\avg\install.au3 RunWait('"' & @ScriptDir & '\avg_free_stf_en_90_707a1765.exe" ' & _ '/PROGRESSONLY /NOSTART /DISABLE_SCAN /NOAVGTOOLBAR ' & _ '/REMOVE_FEATURE fea_AVG_SafeSurf /REMOVE_FEATURE fea_AVG_SafeSearch') ; in C:\installfiles\AcrobatReader\install.au3 RunWait('"' & @ScriptDir & '\AdbeRdr920_en_US.exe" /sAll') ; in C:\installfiles\CClearner\install.au3 RunWait('"' & @ScriptDir & '\ccsetup229_slim.exe" /S') ; in C:\installfiles\dot net framework 3.5\install.au3 RunWait('"' & @ScriptDir & '\dotnetfx35.exe" /qb /norestart') Oh, if you have not already got it, get the slim CCleaner from the other builds section of the download page here. It has no spyware. if ProcessExists($pid) Then Do ProcessClose($pid) Until ProcessWaitClose($pid) EndIf ProcessWaitClose($pid) The code above may cause problems. Best to work with the install rather then against it. MSIexec can be temperamental so take care when using "ProcessClose($pid)" . The loop would also not loop as "Until ProcessWaitClose($pid)" blocks until the process is closed so instead use "Until Not ProcessExists($pid)" . I would probably only use "ProcessWaitClose($pid)" if I were to not use the switches previously mentioned. 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