Help - Search - Members - Calendar
Full Version: the guide of "Using autoit for silent install"
MSFN Forums > Unattended Windows Discussion & Support > Application Installs

   


Google Internet Forums Unattended CD/DVD Guide
master_mtz
hi all , i am making this little guide to help making autoit scripts , to avoid the troubles 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 :



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 ....



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 no.gif , i used taskkill to
get rid of those processes and i succeded thumbup.gif
---------------------------------
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 ....








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
MAVERICKS CHOICE
Nice example Dude & I'm sure it will be of use thumbup.gif .
redfive19
great guide for n00bs....i started learning autoit in march of this year and i am already somewhat proficient at it. I think anyone interested in using autoit would be well served checking out this man's guide. it's a good intro to how powerful and easy autoit can be....
master_mtz
@ MAVERICKS CHOICE
thx 4 ur reply
@ redfive19
well ,actually i made it for nooobs like me biggrin.gif ....
not for professionals cool.gif
and i wrote this simple guide cuz i didn't find any thing about autoit here excepting the autoit scripts collection no.gif

at all ,
i thank u all guys for posting replies thumbup.gif
dirtwarrior
I cant wait to try it out, it still looks a little intemidating tho
MHz
Nice guide, master_mtz.
It is a good starting reference for noobs of AutoIt.
Scite4AutoIt3 has all the tools onboard for making AutoIt scripts as easy as possible. As a user may get to know some of the vast amount of inbuilt functions, then AutoItMacroGenerator could be used. This program is made for unattended installs in mind. AutoItMacroGenerator records as well. Some knowledge of the Control*() functions maybe needed to edit the final draft script created by AutoItMacroGenerator.
CMenu can create AutoIt scripts for silent installing. The thread is in this forum.
Certainly a nice range of tools, to help the user with creating installation scripts. smile.gif
Railman5
Yea like the guide master_mtz.

nice and simple.

not come across this topic before so I am gonna study your guide and give it a try.

thanks for your good work

thumbup.gif
neoandersom
I have been searching all over this forum to find a solution to installing applications that do not yet have a answer file or silent switch yet! In fact it was the main reason why I registered!

This is the answer, compact and easy... Master_mtz, you are my hero newwink.gif tongue.gif
master_mtz
@ Railman5 and dirtwarrior
rhx 4 replying
@ neoandersom
really glad to be ur hero thumbup.gif biggrin.gif
@ MHZ
well , if i had known about Cmenu before i would haven't written this guide :no blushing.gif
Bu i think the guide is still helpful for beginners and noobs smile.gif :rolleyes
Mekrel
Thats an ok way of doing things smile.gif , but I suggest learning AutoIT as its come in so much use for me, and not just for unattended installs.

I wrote this, the other day:

CODE
; Delete Registry Key, to make Start Menu alphabetically sorted
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder")

If ProcessExists("firefox.exe") Then
   MsgBox(0, "CleanScript Notice", "Firefox.exe is running, closing this message will kill the process")
   ProcessClose("firefox.exe")
Else
   MsgBox(48, "CleanScript Notice", "Firefox process not running", 5)
EndIf

; Open Firefox's profiles.ini in read only mode
$file = FileOpen(@AppDataDir & "\Mozilla\Firefox\profiles.ini", 0)

; Check the file is open and can be read
If $file = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf

; Read line 7 of that file, which will return the profile path we need.
$line = FileReadLine($file, 7)

; Trim the string from the left
$fetchedpath = StringTrimLeft($line, 14)

; Close the file
FileClose($file)

; Remove Firefox cache
DirRemove(@AppDataDir & "\Mozilla\Firefox\Profiles\" & $fetchedpath & "\Cache", 1)
DirRemove(@AppDataDir & "\Mozilla\Firefox\Profiles\" & $fetchedpath & "\Cache.Trash", 1)

; Delete users temporary files
FileDelete(@TempDir & "\*.*")
DirRemove(@TempDir, 1)

; Delete Firefox form and browser history
FileDelete(@AppDataDir & "\Mozilla\Firefox\Profiles\" & $fetchedpath & "\history.dat")
FileDelete(@AppDataDir & "\Mozilla\Firefox\Profiles\" & $fetchedpath & "\formhistory.dat")

; Search for all "fixed" drives
$var = DriveGetDrive( "fixed" )
If NOT @error Then
    For $i = 1 to $var[0]
 $String = $var[$i]
 $Disk = StringTrimRight($String, 1)
 RunWait(@ComSpec & " /c " & "Diskeeper " & $Disk & " /b")
 TrayTip("CleanScript message:", "" & $var[$i] & " Drive defragmented", 7, 1)
    Next
EndIf

; Write command to shutdown system, using RunOnceEx
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx", "TITLE", "REG_SZ", "Scheduled Shutdown")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\001", "1", "REG_SZ", "Shutdown -s -t 10 -c ""Shutting down after cleaning system"" /f")

; Reboot the machine
#include <Process.au3>
$rc = _RunDos("shutdown -r -t 05")


Uses disk keeper to defrag my hard drives and cleans up my firefox browser and performs a boot optimisation, reboots and then shuts down the system.

Good to use when I wanna go to bed, just run it and turn off my monitor and let the system handle itself.
MHz
QUOTE (master_mtz @ Aug 3 2005, 04:34 AM)
@ MHZ
well , if i had known about Cmenu before i would haven't written this guide  :no blushing.gif
Bu i think the guide is still helpful for beginners and noobs  smile.gif  :rolleyes
*

Yes, it is good for the beginners. I did state that previously? I do mention also of other options that people may not be aware of. The first tool that I would think of is AutoMacroGenerator, if I wanted an application to record a automated gui install with AutoIt. I use CMenu to do up silent installation scripts. I would use Au3Record for manipulating items on the desktop, that only a keyboard and mouse can manage. So, each of the said tools, have a different purpose of their capabilites. If you want to use any of these options to do unattended installations, then that is ok by me.
There is a tutorial in the AutoIt help guide that shows you how to install Winzip. Once you have learnt to make use of the Win*() functions, and Send() etc. then you should have a look at the Control*() functions, as mentioned at the bottom of the page. Learning is about doing one thing at a time, so learning the primary functions 1st is a good way to go. So, this guide above is also a good place to start. But should be noted, as not the be all and end all of accomplishing installations with AutoIt. Once you can do installations manually written with AutoIt, then you should be able to do many more things with it. It is a very powerful language for scripting your everyday needs etc.
A simple and basic guide, is good for the newcomers of AutoIt. This guide fits that need. So, nice work again, master_mtz. newwink.gif
frostymind
After reading this post I am still a little unsure how you consider this a silent install. To me, a silent install is something that can be run without seeing any screens flash up and could be installed during computer startup. AutoIT seems to just hit the buttons that an end user would normally push and the screens still flash by. So if it has to see windows to hit buttons, it can't be done silently. Can you please explain to me how it would be done silently?

Jeff
Maelstorm
QUOTE (frostymind @ Feb 14 2006, 06:16 AM) *
After reading this post I am still a little unsure how you consider this a silent install. To me, a silent install is something that can be run without seeing any screens flash up and could be installed during computer startup. AutoIT seems to just hit the buttons that an end user would normally push and the screens still flash by. So if it has to see windows to hit buttons, it can't be done silently. Can you please explain to me how it would be done silently?

Jeff


Because some programs cannot be installed silently. MusicMatch Jukebox and iTunes are two examples. What this does is allow an UNATTENDED installation of a program. Yes, the user still sees the screens fly by, but their interaction is not required to install the program. A silent installation is one that you describe: Minimal or non-existant indications that a program is being installed. Many programs can be installed like this, others can't.

The two terms are sometimes confused.
mrshark
thanks for this great and clear guide!
I downloaded crapcleaner 1.27 (http://www.ccleaner.com), updated just today, and i want to use autoit to get rid of the omnipresent yahoo toolbar bundled with it, and to set 2 more options in the standard setup. Following your guide and using the editor (to add the $SF_1 section), i get this autoit script (i use italian as default install language):
CODE
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)

$SF_1 = "ccsetup127.exe"
If WinExists ( $SF_1 ) Then Exit
AutoItWinSetTitle ( $SF_1)
Run('ccsetup127.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("{TAB}{ENTER}")
WinWait("Installazione di CCleaner v1.27","Benvenuti nel progra")
If Not WinActive("Installazione di CCleaner v1.27","Benvenuti nel progra") Then WinActivate("Installazione di CCleaner v1.27","Benvenuti nel progra")
WinWaitActive("Installazione di CCleaner v1.27","Benvenuti nel progra")
Send("{ENTER}")
WinWait("Installazione di CCleaner v1.27 ","Prego leggere le con")
If Not WinActive("Installazione di CCleaner v1.27 ","Prego leggere le con") Then WinActivate("Installazione di CCleaner v1.27 ","Prego leggere le con")
WinWaitActive("Installazione di CCleaner v1.27 ","Prego leggere le con")
Send("{TAB}{TAB}{ENTER}")
WinWait("Installazione di CCleaner v1.27 ","Scelta della cartell")
If Not WinActive("Installazione di CCleaner v1.27 ","Scelta della cartell") Then WinActivate("Installazione di CCleaner v1.27 ","Scelta della cartell")
WinWaitActive("Installazione di CCleaner v1.27 ","Scelta della cartell")
Send("{TAB}{TAB}{TAB}{ENTER}")
WinWait("Installazione di CCleaner v1.27","Opzioni di Installaz")
If Not WinActive("Installazione di CCleaner v1.27","Opzioni di Installaz") Then WinActivate("Installazione di CCleaner v1.27","Opzioni di Installaz")
WinWaitActive("Installazione di CCleaner v1.27","Opzioni di Installaz")
Send("{DOWN}{DOWN}{SPACE}{DOWN}{DOWN}{SPACE}{TAB}{SPACE}{TAB}{TAB}{ENTER}")
WinWait("Installazione di CCleaner v1.27 ","Completamento dell'i")
If Not WinActive("Installazione di CCleaner v1.27 ","Completamento dell'i") Then WinActivate("Installazione di CCleaner v1.27 ","Completamento dell'i")
WinWaitActive("Installazione di CCleaner v1.27 ","Completamento dell'i")
Send("{ALTDOWN}f{ALTUP}")

After saving, using it from right click works perfectly, but when i compile it to exe, ccleaner setup remains on the last screen, waiting that someone press Finish... i tried with different keys (space, enter, alt-f, alt-f4, f), but no way: rclick-exec script works, but compiled exe remains on last screen... any help?
MHz
QUOTE (mrshark @ Feb 15 2006, 08:19 AM) *
After saving, using it from right click works perfectly, but when i compile it to exe, ccleaner setup remains on the last screen, waiting that someone press Finish... i tried with different keys (space, enter, alt-f, alt-f4, f), but no way: rclick-exec script works, but compiled exe remains on last screen... any help?

Here is a easier method for CCleaner v1.27
CODE
$handle = FileOpen(@ProgramFilesDir & '\Yahoo!', 2)
RunWait(@ScriptDir & '\ccsetup127.exe /S')
FileClose($handle)
FileDelete(@ProgramFilesDir & '\Yahoo!')

Func OnAutoItStart()
; A 2nd script instance will exit.
    Local $interpreter
    $interpreter = StringTrimRight(@ScriptName, 4) & ' Script Interpreter'
    If WinExists($interpreter) Then Exit
    AutoItWinSetTitle($interpreter)
EndFunc


The Yahoo installation fails as for 1 empty file created and then removed after the CCleaner install.
The OnAutoItStart() function is the first section of code and will stop a AutoIt script from executing itself.

Edit: And perhaps something even more easier, a link that was posted by vcBlackBox.
mrshark
Thanks for the answer, but the question was "why a COMPILED au3 hangs at the end, not pressing the Finish button, while the same AS SCRIPT pushes it"...

The use of ccleaner was only an example, in particular i was simply applying the guide to the first install-exe found and useful... and it hangs at the end...

Anyway, thanks for your script OnAutoItStart, i'll use it :-)

p.s.: applying the same guide to the new yahoo-less ccleaner (ccsetup127_basic.exe): all works perfectly... bah!
MHz
QUOTE (mrshark @ Feb 15 2006, 04:14 PM) *
Thanks for the answer, but the question was "why a COMPILED au3 hangs at the end, not pressing the Finish button, while the same AS SCRIPT pushes it"...

My guess is the last line should be replaced with
CODE
Send("!f")

That is how I would send Alt-f to the last button. You could add a small Sleep() just before it, if the button is disabled for a short period of time.
Wesmosis
bookmarked! newwink.gif
arkroan
Very Good guide!!!!!!

I am beginner in unattended installations and this saved my time!!!!!!

Thanx master_mtz!!!!!
tcsdoc
With so many people talking about AutoIt scripts I decided to give it a try. I'm not a programmer and only understand enough of unattended installs to create one for myself. The AutoIt way of doing things totally confused me and left me without a means to automate programs without silent installs. My solution was to place the programs on the desktop and run them after an unattended installation.

But your guide with the companion software did the trick. Every program I had to manually install (4 of them) are all fully automatic. This has made AutoIt 'doable' for me.

I don't need to learn all the other 'stuff' as this is a simple excercise in learning to keep my computer updated and easy to repair. Now I can go back to all my other hobbies.

Thanks for the guide and keep up the good work.
embe
@master_mtz

man, this is really cool, perfect guide and perfect tool - I wouldn`t believe if somebody tells me this is possible....

Thousands thumbup.gif
Yagermeister
Hi,

I have used this guide to create a autoit script for Pinnacle studio 9. If i start it manually from the desktop or whereever then it starts to install and works just fine but as soon as i add the whole thing in WPI to install it just starts the installer and then hangs. Does someone perhaps know what this problem can be?

I added the script as attachment here.

Tnx in advance
MHz
Yagermeister,

This is your script optimized some.
CODE
$SF_1 = "Welcome.exe"

If WinExists ( $SF_1 ) Then Exit
AutoItWinSetTitle ( $SF_1)

Run('Welcome.exe')
_WinWaitActive("Studio 9 Plus - InstallShield Wizard","Select the language ")
Send("{UP}{ENTER}")
_WinWaitActive("Studio 9","Geef de volgende inf")
Send("{TAB}blaat{TAB 3}XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX{TAB 3}{SPACE}{TAB 11}{ENTER}")
_WinWaitActive("Studio 9    (Pinnacle Systems - Registratie)","")
Send("{TAB 5}{ALTDOWN}{ALTUP}{DOWN 2}{ENTER}")
_WinWaitActive("Installatie van Windows XP , Version 9.3","Licentieovereenkomst")
Send("{TAB 4}{SPACE}{TAB 3}{ENTER}")
_WinWaitActive("Installatie van Windows XP , Version 9.3","Selecteer het type i")
Send("{ENTER}")
_WinWaitActive("Installatie van Windows XP , Version 9.3","Huidige instellingen")
Send("{ENTER}")
_WinWaitActive("classname=#32770","Bezig met installere")
Send("{PAUSE 5}")
_WinWaitActive("Vraag","Moet er een shortcut")
Send("{ENTER}")
_WinWaitActive("Installatie van Windows XP , Version 9.3","Ja, ik wil mijn comp")
Send("{DOWN}{ENTER}")

Func _WinWaitActive($title, $text = "")
    WinWait($title, $text)
    If Not WinActive($title, $text) Then
        WinActivate($title, $text)
    EndIf
    WinWaitActive($title, $text)
EndFunc

An issue is that you are using a classname for a window title without setting an option to use them as below.
CODE
Opt('WinTitleMatchMode', 4)

With that window title, I'm not even sure if you should have it within the script and you just press the (PAUSE) keys 5 times? The classname title looks like an explorer window which you can just use WinClose on. I would assume by looking at it that the rest does looks normal.

Make sure that a window called "Welcome.exe" is not running when you start your script as it will exit as your first few lines will ensure that.

If possible, you may find it better to use AutoItMacroGenerator to generate a script for installations using Control*() functions. AutoItMacroGenerator is an included tool in CMenu, SendToA3X, or the Scite4AutoIt3 editor.

Edit:
SendToA3X v1.1 has now an item to tidy Au3Recorder generated scripts like the above code as shown above as easy as a wink. newwink.gif
Inferi0r
*removed*
fozzy2005
im a complete noob to all this, and ive managed to follow our instructions, is there some were that will give me a tutorial on creating a rarsfx, cant find one, and after trying to figure it out for the past hour is gettin annoying!

thanks for the tutorial smile.gif
Inferi0r
I have a question about silent installs maked with Autoit Scite Script Writer.

Is it possible that you don't see the install screen?
Plamdi
QUOTE (arco @ Oct 24 2006, 01:52 AM) *
I have a question about silent installs maked with Autoit Scite Script Writer.

Is it possible that you don't see the install screen?
No it isn't, the only way to do that is by compleatly rewriting the installation package.
Core3Trio
wow... thanks for the guide.. it looks like not hard for noobs like me..

but,the image in page 1 is already deleted.. could u upload another one,please?

Thanks... biggrin.gif
dottbin
hi mtz,
I need your help blushing.gif
when I launched au3record I must flag also 'record mouse' as if I unflag it, after stopping au33record, I obtain only following lines:
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('D:\Sotware indispensabili\WinRAR.v3.71.Regged.Italiano-YAG\WinRAR.v3.71.Regged.Italiano-YAG\wrar371it.exe')


meanwhile if I flag 'record mouse' I obtained all script as follow:
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('D:\Sotware indispensabili\WinRAR.v3.71.Regged.Italiano-YAG\WinRAR.v3.71.Regged.Italiano-YAG\wrar371it.exe')
WinWait("WinRAR 3.71","Copyright © 1993-200")
If Not WinActive("WinRAR 3.71","Copyright © 1993-200") Then WinActivate("WinRAR 3.71","Copyright © 1993-200")
WinWaitActive("WinRAR 3.71","Copyright © 1993-200")
MouseMove(215,381)
MouseDown("left")
MouseUp("left")
WinWait("Configurazione WinRAR","Associa a WinRAR arc")
If Not WinActive("Configurazione WinRAR","Associa a WinRAR arc") Then WinActivate("Configurazione WinRAR","Associa a WinRAR arc")
WinWaitActive("Configurazione WinRAR","Associa a WinRAR arc")
MouseMove(34,95)
MouseDown("left")
MouseUp("left")
MouseMove(30,95)
MouseDown("left")
MouseUp("left")
MouseMove(201,378)
MouseDown("left")
MouseUp("left")
WinWait("Configurazione WinRAR","WinRAR è stato insta")
If Not WinActive("Configurazione WinRAR","WinRAR è stato insta") Then WinActivate("Configurazione WinRAR","WinRAR è stato insta")
WinWaitActive("Configurazione WinRAR","WinRAR è stato insta")
MouseMove(251,389)
MouseDown("left")
MouseUp("left")
WinWait("WinRAR","FolderView")
If Not WinActive("WinRAR","FolderView") Then WinActivate("WinRAR","FolderView")
WinWaitActive("WinRAR","FolderView")
MouseMove(783,14)
MouseDown("left")
MouseUp("left")


where is my mistake?
can you help me?
thank in advanced
dottBin
chyronn
you need to make sure the "Record Window Text" option is ticked and "Record Mouse" is unticked
dottbin
thanks chyronn for your answer.
Anyway I found my mistake: during installation I used mouse instead of keyboard

now I wolud like to hide installation screen during installation. Any suggestion?

BR,
Gianni
simurqq
See above for Plamdi's post. I've personally tried to hide setup windows for countless number of times - no way!!!
chaoticyeshua
If it's that big of a deal, you could always just move the window off screen using something like this:

CODE
WinWait("Title","Text")
WinMove("Title","Text",-1000,-1000)


This way it'll wait for the window to exist, then move it off of the screen where it is no longer visible. It will show for a split second, then be moved.
jamesbebby
hi, whats the second progarm link not workin?
cheers james thumbup.gif




Google Internet Forums Unattended CD/DVD Guide

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.