Sorian Posted December 19, 2006 Share Posted December 19, 2006 (edited) Is there a way to write one continuous script instead of several small scripts?Example:CODERun("AdbeRdr80_en_US.exe")WinWait("Adobe Reader 8 - Setup")If WinActive("Adobe Reader 8 - Setup","Setup will allow you to repair or remove Adobe Reader 8. To continue, click Next.")Then Send("!C") Winactive("Adobe Reader 8 - Setup","Are you sure you want to cancel Adobe Reader 8 installation?") Send("!Y") Winactive("Adobe Reader 8 - Setup","Your system has not been modified.") Send("!F") ExitEndIfWinWait("Adobe Reader 8 - Setup","Destination Folder")Send("!N")WinWait("Adobe Reader 8 - Setup","Ready to Install the Program")Send("!I")WinWait("Adobe Reader 8 - Setup","Setup Completed")Send("{tab}")Send("{space}")Send("!F")WinWait("setup","Setup needs to restart your system to complete the installation.")Send("!N")ExitIn this script I have it so if Adobe Reader 8 is installed, it will close; otherwise it will installCODERun("QuickTimeInstaller.exe")If WinWaitActive("QuickTime for Windows","Repair or remove QuickTime")Then Send("{tab 2}") Send("{enter}") WinActive("QuickTime for Windows","Are you sure you want to cancel QuickTime installation?") Send("!Y") WinActive("QuickTime for Windows","The installer was interrupted before the requested operations for QuickTime could be completed.") Send("!F") ExitEndIfWinWaitActive("QuickTime for Windows","Welcome to the QuickTime 7 Installer")Send("!N")WinActive("QuickTime for Windows","License Agreement")Send("!Y")WinActive("QuickTime for Windows","Destination Folder")Send("!I")WinActive("QuickTime for Windows","QuickTime Installer Completed")Send("!F")WinActive("QuickTime for Windows","QTProBanner.bmp")Send("{tab}")Send("{enter}")ExitThis is for Quicktime, same setup as for the Adobe install. (if its installed, it will close; otherwise it will install)I need to replace the Exit with something so it will continue the script to the next point.I could make each install their own script and put Run("insert next install script.exe") but I was hoping for just one script file.Would look something like this:CODE;Install Adobe Reader 8Run("AdbeRdr80_en_US.exe")WinWait("Adobe Reader 8 - Setup")If WinActive("Adobe Reader 8 - Setup","Setup will allow you to repair or remove Adobe Reader 8. To continue, click Next.")Then Send("!C") Winactive("Adobe Reader 8 - Setup","Are you sure you want to cancel Adobe Reader 8 installation?") Send("!Y") Winactive("Adobe Reader 8 - Setup","Your system has not been modified.") Send("!F") Starts the QuickTime installer section in scriptEndIfWinWait("Adobe Reader 8 - Setup","Destination Folder")Send("!N")WinWait("Adobe Reader 8 - Setup","Ready to Install the Program")Send("!I")WinWait("Adobe Reader 8 - Setup","Setup Completed")Send("{tab}")Send("{space}")Send("!F")WinWait("setup","Setup needs to restart your system to complete the installation.")Send("!N");Install QuicktimeRun("QuickTimeInstaller.exe")If WinWaitActive("QuickTime for Windows","Repair or remove QuickTime")Then Send("{tab 2}") Send("{enter}") WinActive("QuickTime for Windows","Are you sure you want to cancel QuickTime installation?") Send("!Y") WinActive("QuickTime for Windows","The installer was interrupted before the requested operations for QuickTime could be completed.") Send("!F") Starts the next installer in scriptEndIfWinWaitActive("QuickTime for Windows","Welcome to the QuickTime 7 Installer")Send("!N")WinActive("QuickTime for Windows","License Agreement")Send("!Y")WinActive("QuickTime for Windows","Destination Folder")Send("!I")WinActive("QuickTime for Windows","QuickTime Installer Completed")Send("!F")WinActive("QuickTime for Windows","QTProBanner.bmp")Send("{tab}")Send("{enter}");Install ...Run("next install.exe") Edited December 19, 2006 by Sorian Link to comment Share on other sites More sharing options...
mikehunt114 Posted December 19, 2006 Share Posted December 19, 2006 There are several options. You could always do an If ($expression) Then Run($otherscript). Or perhaps you could just #include the other script and call a function from it. Or, you could put the whole second script in the first script, and adjust the code accordingly. Hopefully that gives you some ideas. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
kjmarket Posted December 19, 2006 Share Posted December 19, 2006 Try a simple loop, like a while, and check every so many seconds if the particular window you are looking for exists, and if it does, call a function. That would be the easiest way. Pink Floyd - The Wall Link to comment Share on other sites More sharing options...
JoshDB Posted December 19, 2006 Share Posted December 19, 2006 expandcollapse popupInstallAdobeReader() Func InstallAdobeReader() ;Install Adobe Reader 8 Run("AdbeRdr80_en_US.exe") WinWait("Adobe Reader 8 - Setup") If WinActive("Adobe Reader 8 - Setup","Setup will allow you to repair or remove Adobe Reader 8. To continue, click Next.")Then Send("!C") Winactive("Adobe Reader 8 - Setup","Are you sure you want to cancel Adobe Reader 8 installation?") Send("!Y") Winactive("Adobe Reader 8 - Setup","Your system has not been modified.") Send("!F") InstallQuickTime() EndIf WinWait("Adobe Reader 8 - Setup","Destination Folder") Send("!N") WinWait("Adobe Reader 8 - Setup","Ready to Install the Program") Send("!I") WinWait("Adobe Reader 8 - Setup","Setup Completed") Send("{tab}") Send("{space}") Send("!F") WinWait("setup","Setup needs to restart your system to complete the installation.") Send("!N") EndFunc Func InstallQuickTime() ;Install Quicktime Run("QuickTimeInstaller.exe") If WinWaitActive("QuickTime for Windows","Repair or remove QuickTime")Then Send("{tab 2}") Send("{enter}") WinActive("QuickTime for Windows","Are you sure you want to cancel QuickTime installation?") Send("!Y") WinActive("QuickTime for Windows","The installer was interrupted before the requested operations for QuickTime could be completed.") Send("!F") InstallNextProgram() EndIf WinWaitActive("QuickTime for Windows","Welcome to the QuickTime 7 Installer") Send("!N") WinActive("QuickTime for Windows","License Agreement") Send("!Y") WinActive("QuickTime for Windows","Destination Folder") Send("!I") WinActive("QuickTime for Windows","QuickTime Installer Completed") Send("!F") WinActive("QuickTime for Windows","QTProBanner.bmp") Send("{tab}") Send("{enter}") EndFunc Use the functions, grasshopper. Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite Link to comment Share on other sites More sharing options...
MadBoy Posted December 20, 2006 Share Posted December 20, 2006 If i were you i would use silent switches for installators instead of automating GUI for those apps. 90% of apps can be installed with some silent switch like setup.exe /s or so and it will install automagically without all this code As for your installer.. Use functions: ; To run Adobe installer... in silent mode InstallAdobe() ; to run office installer .. etc InstallOffice() Func InstallAdobe() Run("AdbeRdr80_en_US.exe /sAll /rs") EndFunc Func InstallOffice() EndFunc My little company: Evotec (PL version: Evotec) 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