Auto It Silent Install
Auto It Silent Install
of finding switches and so on ..... ============================================== here we go ..... ============================================= ----------------------what is an Autoit Script -----------------------it is a simple script , made to do jobs automatically , u write down the script (the script is mainly a robot that will tell the system what to do ) , then compile it , the resulting exe will do what u specifed in the code each time the program runs, ---------------------------What is the relation between Auto it and silent install: --------------------------simply , u wil make the installation go smoothly , without ur interaction , the script u make will do the job ..... u may see examples in this topic : http://www.msfn.org/board/index.php?showtopic=20197 --------------------OHH dear , shall i write scripts and think of coding ---------------------Answer is , NO , u will see in this guide , how will we make scripts for silent installs without writing code. -----------------------Why and when shall i use autoit for silent install ? -----------------------when u don't find the silent switch u need , u are pushed to use the autoit method .. ==============NOW LET US GOOO!!!!================ firstly we need the program ,,, get it here http://www.autoitscript.com/cgi-bin/getfil...it-v3-setup.exe and we need the Scite tool , to use the script recorder:: Scite --------http://www.autoitscript.com/cgi-bin/getfil...iTe4AutoIt3.exe install both programs ,,, now go to : Start >>programs>>autoit V3>>scite>>Script Writer u will see this : scritptw.PNG
1- select the installation package which u r going to make the script for , it shall be an EXE which the script will call each time it runs .......... 2- make the check boxes , as made in the pic 3- click the "A" button once we click the "A" button,the exe(which is the installation package) we specifed will run, and every movement we make on our pc using the keyboard will be recorded, During the record of this code , Take care of : 1-Avoid Alt+tab, or navigating to othr windows 2- use " Alt+N" to choose "next" Alt+y to choose " Yes" , and so on .. 3- u may use the Tab button to navigate between buttons After u completly installed the application , we have to stop the record operation by clicking the "A" button at the upper left of the screen , now u must see some code written like this .... daemonsc.PNG
Now , we have to add little code to our app , to avoid hassles , and running same application again and again ------------------------------------$SF_1 = "app.exe" If WinExists ( $SF_1 ) Then Exit AutoItWinSetTitle ( $SF_1) --------------------------------------** u may ask , what is this attented for , the answer is , this code is just a safety measure during the testing period , i once used a script which don't have this code (or similiar) and a big trouble occourded , the compiled EXE kept running it self again and again , and at last , 101 process where running on my poor pc , i used taskkill to get rid of those processes and i succeded :thumbup --------------------------------replace app.exe by the installation package exe u selected when recording the script, now save the file near by ur EXE package as u see in the pic , then compile the script .... compile.PNG
NOW all is done we have the compiled EXE , try running it now , u will see every thing in the setup going automatically without ur interaction , once u test and find every thing working good , u may make a RARsfx which will have the compiled EXE to run after the extraction process I found this useful when I cant find any silent switches for my installers :thumb_yello: Attached Files
daemonsc.PNG 24.68K 774 downloads scritptw.PNG 18.55K 895 downloads compile.PNG 175.17K 537 downloads
This command starts a defrag of the C: drive and the -f switch forces a defragmentation even if the free space is low. If you ran this command in DOS yourself, you would get the exact same outcome. You can also try this with many other DOS commands. As for the exit line, it just tells the script to close when its finished.
Now we know what it does, right click on your .au3 file and choose Run Script. You should see the DOS window show up and it will start defragging the C: drive. The problem with .au3 files is that the Run Script option wont show up on other computers unless they have AutoIT installed so we need to compile the script to make it portable. Right click on your .au3 file again and choose Compile Script. This will create an .exe version of your script. So if you have named your au3 script mycode.au3, there will now be a file called mycode.exe. This has made our script portable and can be run on any Windows computer. Automating Installs For this automated install example, well be installing the popular compression software 7zip which you can download here. Once it has been downloaded, we need to find out which switch tells the 7zip installer to install silently so that it doesnt show us the setup menu. To do that, we can use Universal Silent Switch Finder which you can download here. Run Universal Silent Switch Finder, press the > button and find the 7zip install. It will then fill out the Usage field which should be 7z457.exe /S which means /S is our silent switch. Clear out your old .au3 scripts or start a new one and add:
RunWait("7z457.exe /S ") Exit
This script assumes that the 7zip installer is in the same directory as the script. Note: Be careful with the quotation marks because the line from USSF and the line needed in the code have them in different places. Run this script and if you did it correctly, it will appear that nothing has happened. Check your Start Menu or the Program Files folder and you should see at 7zip has been installed. To add mutliple applications to be automatically installed you would do something like:
RunWait("7z457.exe /S ") RunWait("AVG8.exe /s ") Exit
Automating the Running of Applications AutoIT doesnt just limit you to just automating the install of an application, you can also automate the running of them too.
For example, we can tell an application like Clamwin which a portable virus scanner, to scan the C drive for viruses and once they are found, delete them, using the following line
RunWait("ClamWin.exe --mode=scanner --path=c: --remove --close")
To find the command line switches for different applications, try the applications documentation or search for them on Google. Thats it for part 1 and we have barely scratched the surface with what AutoIT is capable of, in part 2 of our AutoIT article well show you how to automate an installation of an application that doesnt have install switches and how to install registry tweaks. For additional help with what we have worked with here, AutoIT has some great documentation. Special thanks to our forum member focuz, who sent in many of his AutoIT automation examples which much of this article is based off.
In the last article we used the command RunWait. The difference between RunWait and Run is that Run wont wait until the application closes before going onto the next command. However, we do need to detect that the installer actually opened properly so we will be using the following command:
WinWaitActive("Installer Language")
This line causes the script wait until it sees a window titled Installer Language before going to the next line. The Installer Language window is the first Window we will see
Now, imagine that you dont have a mouse and can only use the keyboard. If we want to continue we would press ENTER to press OK. So we will send the ENTER key to the Winamp Installer.
Send("{ENTER}")
The next installer screen just lists the features of the newest Winamp version and we can just press the Next button by pressing ENTER to bypass this:
WinWaitActive("Winamp Installer") Send("{ENTER}")
Now we are on the License Agreement page but the script needs to detect that we are actually on this screen by checking for a word that is on it. In this case the line License Agreement appears so we will tell the script to look for it using the following command:
WinWaitActive("Winamp Installer", "License Agreement")
All we need to do to for this stage is to press the I Agree button. So we will send the ENTER keystroke again to press the button.
Send("{ENTER}")
The next screen allows us to choose the install location. Once again, we need to detect we are actually on this screen so we use the following line:
WinWaitActive("Winamp Installer", "Choose Install Location")
The default location is c:\Program Files\Winamp but I would like to change this for examples sake, so I send the following text to the text field:
Send("C:\Applications\Winamp")
Now we are on the page that allows us to choose the components that are going to be installed.
I usually install all of them when installing Winamp onto a clients computer so we are just going to press Next. If you want to deselect some options, I will show you how to do that in the next few steps, but for now all I am going to do is detect the screen and press next.
WinWaitActive("Winamp Installer", "Choose Components") Send("{ENTER}")
The next page allows us to choose some start options, once again I will be leaving this is default and pressing Next.
WinWaitActive("Winamp Installer", "Choose Start Options") Send("{ENTER}")
Now we are onto Winamps Additional Features. I dont know about you but I hate these options because it installs a toolbar, changes your search provider and places an advertisement icon on your desktop, so I will be deselecting all of these.
Remember how I said to imagine that you dont have a mouse? As you probably know the way to cycle through the options in an application is to press TAB. So I need to press TAB once which will move the selector to the Cancel Button. Press it again to be on the Winamp Remote option and then press SPACE to deselect it. Then press TAB again to get to the next one and press SPACE to deselect the Winamp Toolbar. I do this twice more to Deselect the Search option and the 50 free Mp3s option. I press TAB again which takes me to the Back button and press TAB once more to get to the Install button. Once I am on the Install button I press ENTER.
WinWaitActive("Winamp Installer", "Get the Most Out of Winamp") Send("{TAB}{TAB}{SPACE}{TAB}{SPACE}{TAB}{SPACE}{TAB}{SPACE}{ENTER}")
Winamp will start installing and we need to detect the Installation Complete text so we know when the installation has finished.
WinWaitActive("Winamp Installer", "Installation Complete")
Now we have one last option left, the Launch Winamp after the installer closes option. Since this article is about unattended installs, I am going to deselect it and press Finish:
WinWaitActive("Winamp Installer", "Installation Complete") Send("{TAB}{SPACE}{ENTER}")
Thats it! Winamp should now be installed. Here is the complete code:
Run("WinampInstall.exe") WinWaitActive("Installer Language") Send("{ENTER}") WinWaitActive("Winamp Installer") Send("{ENTER}") WinWaitActive("Winamp Installer", "License Agreement") Send("{ENTER}") WinWaitActive("Winamp Installer", "Choose Install Location") Send("C:\Applications\Winamp") Send("{ENTER}") WinWaitActive("Winamp Installer", "Choose Components") Send("{ENTER}") WinWaitActive("Winamp Installer", "Choose Start Options") Send("{ENTER}") WinWaitActive("Winamp Installer", "Get the Most Out of Winamp") Send("{TAB}{TAB}{SPACE}{TAB}{SPACE}{TAB}{SPACE}{TAB}{SPACE}") Send("{ENTER}") WinWaitActive("Winamp Installer", "Installation Complete") Send("{TAB}{SPACE}{ENTER}")
I have created a thread in Technibbles forums and added the code used in this example which you can find here. I have also posted code samples on how to install .reg files and a few other tasks. I know many of you will be creating your own scripts after this tutorial, if we all share our scripts with one another we can build a nice collection of application install scripts for everyones benfit.