Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

the guide of "Using autoit for silent install"

- - - - -

  • Please log in to reply
35 replies to this topic

#1
master_mtz

master_mtz

    Junior

  • Member
  • Pip
  • 71 posts
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/...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.autoitscr...it-v3-setup.exe
and we need the Scite tool , to use the script recorder::

Scite
---------
http://www.autoitscr...iTe4AutoIt3.exe
install both programs ,,,
now go to :
Start >>programs>>autoit V3>>scite>>Script Writer
u will see this :

Posted Image

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


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: , 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 ....
Posted Image







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

Edited by master_mtz, 31 July 2005 - 11:32 PM.



How to remove advertisement from MSFN

#2
MAVERICKS CHOICE

MAVERICKS CHOICE

    The Guy from Aus

  • Member
  • PipPipPipPipPipPipPip
  • 1,759 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Nice example Dude & I'm sure it will be of use :thumbup .

#3
redfive19

redfive19

    Junior

  • Member
  • Pip
  • 96 posts
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....

#4
master_mtz

master_mtz

    Junior

  • Member
  • Pip
  • 71 posts
@ MAVERICKS CHOICE
thx 4 ur reply
@ redfive19
well ,actually i made it for nooobs like me :D ....
not for professionals B)
and i wrote this simple guide cuz i didn't find any thing about autoit here excepting the autoit scripts collection :no:

at all ,
i thank u all guys for posting replies :thumbup

#5
dirtwarrior

dirtwarrior

    OS modder

  • Member
  • PipPipPipPipPipPip
  • 1,467 posts
I cant wait to try it out, it still looks a little intemidating tho
Posted Image

#6
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag
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. :)

#7
Railman5

Railman5

    Member

  • Member
  • PipPip
  • 154 posts
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

#8
neoandersom

neoandersom
  • Member
  • 7 posts
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 ;) :P

#9
master_mtz

master_mtz

    Junior

  • Member
  • Pip
  • 71 posts
@ Railman5 and dirtwarrior
rhx 4 replying
@ neoandersom
really glad to be ur hero :thumbup :D
@ MHZ
well , if i had known about Cmenu before i would haven't written this guide :no :blushing:
Bu i think the guide is still helpful for beginners and noobs :) :rolleyes

#10
Mekrel

Mekrel

    Advanced Member

  • Member
  • PipPipPip
  • 372 posts
Thats an ok way of doing things :) , 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:

; 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.
AMD64 Opteron 146 300*10 | OCZ Platinums Rev2 5/6 1T 2.5-3-3-5 @ 2.8v | DFI NF4 SLI-DR | X1800XL @ XT | X-Mystique 7.1 Soundcard | 2*36Gb Raptor Raid0 | NEC DVD-Rw | Tagan TG580-U15 PSU | Lian-Li PC7SE | Viewsonic VP171s

#11
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag

@ MHZ
well , if i had known about Cmenu before i would haven't written this guide  :no :blushing:
Bu i think the guide is still helpful for beginners and noobs  :)  :rolleyes

<{POST_SNAPBACK}>

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

#12
frostymind

frostymind
  • Member
  • 1 posts
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

#13
Maelstorm

Maelstorm

    AT Field Pattern Blue

  • Member
  • PipPip
  • 265 posts

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

#14
mrshark

mrshark

    Newbie

  • Member
  • 15 posts
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):
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?

#15
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag

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

Edited by MHz, 14 February 2006 - 08:02 PM.


#16
mrshark

mrshark

    Newbie

  • Member
  • 15 posts
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!

Edited by mrshark, 15 February 2006 - 12:22 AM.


#17
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag

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

#18
Wesmosis

Wesmosis

    Just Call Me Doctor Just Call Me Pain!

  • Member
  • PipPipPipPipPip
  • 787 posts
bookmarked! ;)
@I dont know how the third World War will be fought, but I`m sure the fourth will be fought with sticks and stones
@Like What You Do, If You Can't Do What You Like
@Reality.Sys Corrupted. Universe Halted. Reboot Y/N

#19
arkroan

arkroan
  • Member
  • 1 posts
Very Good guide!!!!!!

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

Thanx master_mtz!!!!!

#20
tcsdoc

tcsdoc

    Junior

  • Member
  • Pip
  • 61 posts
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.

#21
embe

embe

    Junior

  • Member
  • Pip
  • 81 posts
@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
P4 Northwood 2.8GHz HT, I865PE Gigabyte 8IPE1000P, DDR-SDRAM 2x512MB CL 2,5 Kingston, ATI RADEON 9800 PRO,C: WD400JB(37GB), D: HD 7k250 SATA (250GB), E: HD 7k250 SATA (250GB), Benq DW 1655 DVD-RW DL, Realtek AC97 Audio, LifeView FlyVideo WDM TV Tuner, WIN-XP_SP2 Lite
_________________________________________________________________________________________

ELECTRONICS.VIZIO.BIZ - TRANCE,PROGRESSIVE,TECHNO,HOUSE,ELECTRONIC,MINIMAL,GOA&PSY MUSIC - GET LATEST SETS FROM CLUBS, EVENTS AND RADIO BROADCAST WORLDWIDE!

#22
Yagermeister

Yagermeister

    Newbie

  • Member
  • 16 posts
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

Attached Files



#23
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,653 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Yagermeister,

This is your script optimized some.
$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.
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. ;)

Edited by MHz, 14 October 2006 - 01:36 AM.


#24
fozzy2005

fozzy2005
  • Member
  • 1 posts
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 :)

#25
Inferi0r

Inferi0r

    Little dude

  • Member
  • PipPip
  • 180 posts
I have a question about silent installs maked with Autoit Scite Script Writer.

Is it possible that you don't see the install screen?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN