;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;
; AutoIt Version: 3.1.1
; Author:         sadicq <sadicq@gmail.com>
;
; Script Function:
;	Installs Kaspersky Antivirus Personal Pro 5.0.383 And Licenses It
;

;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;Please read the comments below as you may want ot modify tha paths and/or the names of the Kaspersky Installer and/or license file
;This is where you edit your variables
$installer_directory = ""	; e.g.: "C:\kaspersky\" (needs last slash), blank means the same directoty with the script; if you want
							; to use variables like @HomeDrive, edit like this: $installer_directory = @homedrive & "\kaspersky\"
$installer_name = "kav5.0.383_personalproen.exe"
$license_directory = "" ; relative paths like "\keyfile\" are NOT available
						; if you leave this variable "" it means the license is in the same directory with the installer
$license_file = "kav5.0.383_personalproen.key"	; leave "" if you have no license and you want the trial one
												; If you have a license, even if it is in same directory with the installer, this
												; variable will not be blank
$install_path = @ProgramFilesDir & "\Kaspersky Lab\Kaspersky Anti-Virus Personal Pro" ; where you want to install the antivirus
$username = "yourname" ;this is the username KAV asks for during install (you may put anything here, :D)
$company = "yourcompany" ;whatever you want
$restart = 0 ;1 to restart when setup finishes
;/////////////// If you are new to Kaspersky leave these following lines alone
$network_protection = 1 ;Enables or disables this features during the setup
$iStreams = 1
;Do not edit below this line
;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Opt("TrayIconHide", 1)
Run($installer_directory & $installer_name)
WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup")
Send("!n")
WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","End User Licence Agreement")
Send("!a")
WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Please enter your name and the name of the company you work for.")
Send($username)
Send("{TAB}")
Send($company)
Send("!n")
WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Operate according to recommended settings")
If $network_protection = 1 And $iStreams = 1 Then
	Send("!n")
Else
	ControlClick("Kaspersky Anti-Virus Personal Pro Setup","Operate according to recommended settings",1201)
	Send("!n")
	WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Select the desired Kaspersky Lab technologies to protect data on your computer.")
	If $network_protection = 0 Then
		ControlClick("Kaspersky Anti-Virus Personal Pro Setup","Select the desired Kaspersky Lab technologies to protect data on your computer",1200)
	EndIf
	If $iStreams = 0 Then
		ControlClick("Kaspersky Anti-Virus Personal Pro Setup","Select the desired Kaspersky Lab technologies to protect data on your computer",1202)
	Endif
	Send("!n")
EndIf
If $license_file <> "" Then
	If $license_directory <> "" Then
		WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Add the license key file you want to install.")
		Send("!b")
		Send($license_directory & $license_file)
		Send("{ENTER}")
		Send("!n")
	EndIf
Else
	WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Add the license key file you want to install.")
	Send("!n")
EndIf	
WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Choose Destination Folder")
Send($install_path)
Send("!i")
WinWaitActive("Kaspersky Anti-Virus Personal Pro Setup","Completing the installation of Kaspersky Anti-Virus Personal Pro")
If $restart = 0 Then
	ControlClick("Kaspersky Anti-Virus Personal Pro Setup","Completing the installation of Kaspersky Anti-Virus Personal Pro",1204)
EndIf
Send("!f")