$SetupFile = "avgsetup.exe" $license = "your licence code" $DataCentre = "yourserver:4158" ; Visual C++ Redistributable must be installed separately if using Group Policy. $InstallVisualCppRedist = 0 ; Installation options ; Destination Folder $DestinationFolder = @ProgramFilesDir & "\AVG\AVG9\" ; AVG Firewall $Firewall = 0 ; Web Shield $WebShield = 1 ; Link Scanner $LinkScanner = 0 ; AVG Active Surf-Shield $ActiveSurfShield = 0 ; Install AVG Search-shield? $SearchShield = 0 ; Remote Control Communication Library $RemoteAdministrationComponent = 1 ; AVG Settings Manager $AVGSettingsManager = 1 ; E-mail Scanner options $EmailScanner = 0 $PluginForTheBat = 0 $PluginForMicrosoftOutlook = 0 $PersonalEmailScanner = 0 $PluginForMicrosoftOffice = 0 ; Security Toolbar $SecurityToolbar = 0 $YahooSearch = 0 ; Languages $LanguageCzech = 0 $LanguageFrench = 0 $LanguageGerman = 0 $LanguageHungarian = 0 $LanguageItalian = 0 $LanguageJapanese = 0 $LanguageDutch = 0 $LanguagePortugueseBrazilian = 0 $LanguagePortuguesePortugal = 0 $LanguagePolish = 0 $LanguageSerbian = 0 $LanguageSlovak = 0 $LanguageSpanish = 0 $LanguageDanish = 0 $LanguageChineseTraditional = 0 $LanguageChineseSimplified = 0 $LanguageTurkish = 0 $LanguageRussian = 0 $LanguageMalay = 0 $LanguageKorean = 0 $LanguageIndonesian = 0 $LanguageEnglishIndia = 0 ; Organise shortcuts ; @StartMenuCommonDir is the path to All Users Start Menu folder ; @StartMenuDir is the path to the current user's Start Menu ; @DesktopCommonDir is the path to All Users Desktop ; @DesktopDir is the path to the current user's Desktop $CopyDesktopIconTo = @StartMenuCommonDir & "\Programs\Accessories\Utilities" $DeleteDesktopIcon = 1 $CopyStartMenuFolderTo = "" $DeleteStartMenuFolder = 1 ; Configuration Wizard options $RunFirstRunWizard = 0 ; Don't bother with the first run wizard in domains. $UpdateFrequency = 1 ; Set to 1 for every four hours, 2 for once a day $ScheduledScan = 2 ; 1: Daily, 2: Weekly (recommended), 3: Never. $ScanTime = "06:42 AM" $ScanDay = "Monday" $RemovableDevices = 0 $PermitUsageInfo = 0 $OptimizeNow = 0 ; Logs success after each step $LogProgress = 1 ; 0 - off, 1 - after each action, 2 - constantly $ProgressLog = "c:\AVG9progresslog.txt" Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 1) Opt("WinDetectHiddenText", 1) $EscapeCounter = 0 $LastLogText = "" Dim $Adlib[25] If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Begin") If $InstallVisualCppRedist = 1 Then $SetupPid = Run($SetupFile) Else $SetupPid = Run($SetupFile & " /no_vc_redist") EndIf If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Setup file executed") ; Wait for the second window to appear. WinWait("AVG 9.0") $StopAdlib = WinGetProcess("AVG 9.0") ; Start the Window checks. AdlibEnable('_Adlib') If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Window checking begun") ProcessWaitClose($StopAdlib) If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Setup file closed") ; Stop checking the window AdlibDisable() If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Window checking stopped") ; Take care of shortcuts and first run wizard (below) Func _Adlib() ; $Adlib[$i] prevents commands being executed twice on the same window. $i=1 $EscapeCounter = $EscapeCounter + 1 ; If the adlib runs x times without doing anything: If $EscapeCounter = 500 Then If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Escaping") ProcessClose($StopAdlib) EndIf $WindowText = ControlGetText("AVG 9.0", "", 1058) If $LogProgress = 2 Then FileWriteLine($ProgressLog, "now: " & $WindowText) ; Welcome to the AVG Setup Program If WinExists("AVG 9.0", "Welcome") and $Adlib[$i] <> 1 Then ControlClick("AVG 9.0", "Welcome", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Welcome Screen") $Adlib[$i] = 1 $EscapeCounter = 0 EndIf $i = $i + 1 ; Please review this license agreement before proceeding with the installation. If WinExists("AVG", "License agreement") and $Adlib[$i] <> 1 Then ; Tick the box to agree ControlCommand("AVG", "License agreement", 1070, "Check") ; Go to the next page ControlClick("AVG", "License agreement", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Review License Agreement") $Adlib[$i] = 1 $EscapeCounter = 0 EndIf $i = $i + 1 ; If AVG has already been installed, it will ask about repair/uninstall... Quit ; If WinExists("AVG", "Select Setup Type") and $Adlib[$i] <> 1 Then ; ControlClick("AVG", "Select Setup Type", 1001) ; Wait for the 'are you sure' prompt and hit yes. ; WinWait("Do you want to exit setup?", "Do you want to exit setup?", 5) ; ControlClick("Do you want to exit setup?", "Do you want to exit setup?", 6) ; If $LogProgress = 1 Then FileWriteLine($ProgressLog, "AVG already installed") ; $EscapeCounter = 0 ; $Adlib[$i] = 1 ; EndIf ; $i = $i + 1 ; If AVG 7 is detected ; If WinExists("AVG", "Attention!") and $Adlib[$i] <> 1 Then ; ControlClick("AVG", "Attention!", 1000) ; If $LogProgress = 1 Then FileWriteLine($ProgressLog, "AVG7 present") ; $EscapeCounter = 0 ; $Adlib[$i] = 1 ; EndIf ; $i = $i + 1 ; Checking System status takes ages. If WinExists("AVG", "Checking System Status") and $Adlib[$i] <> 1 Then ; Wait WinWaitClose("AVG", "Checking System Status") If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Checking System Status") $Adlib[$i] = 1 $EscapeCounter = 0 EndIf $i = $i + 1 ; Select Installation Type If WinExists("AVG 9.0", "Select Installation Type") and $Adlib[$i] <> 1 Then ; Select custom installation ControlCommand("AVG 9.0", "Custom Installation", 1045, "Check", "") ControlClick("AVG 9.0", "Custom Installation", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Select Install Type") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; Activate your AVG License If WinExists("AVG 9.0", "Activate your AVG") And $Adlib[$i] <> 1 Then ; Enter license key ControlSetText("AVG 9.0", "Activate your AVG", 1005, $license) ControlClick("AVG 9.0", "Activate your AVG", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Activate AVG") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; Destination Folder If WinExists("AVG 9.0", "Destination Folder") and $Adlib[$i] <> 1 Then ControlSetText("AVG 9.0", "Destination Folder", 1036, $DestinationFolder) ControlClick("AVG 9.0", "Destination Folder", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Select destination folder") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 If WinExists("Directory does not exist", "Do you want to create the directory?") and $Adlib[$i] <> 1 Then ControlClick("Directory does not exist", "Do you want to create the directory?", 6) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Directory does not exist prompt") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; Component Selection If WinExists("AVG 9.0", "Component Selection") and $Adlib[$i] <> 1 Then ; Click into the list box ControlFocus("AVG 9.0", "Component Selection", 1011) ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Firewall? If $Firewall = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Web Shield? If $WebShield = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Link Scanner? If $LinkScanner = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{RIGHT}") ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install AVG Active Surf-Shield? If $ActiveSurfShield = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install AVG Search-shield? If $SearchShield = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Remote Administratorion Component? If $RemoteAdministrationComponent = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install AVG Settings Manager? If $AVGSettingsManager = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Additional Languages ControlSend("AVG 9.0", "Component Selection", 1011, "{RIGHT}") ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Czech? If $LanguageCzech = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: French? If $LanguageFrench = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: German? If $LanguageGerman = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Hungarian? If $LanguageHungarian = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Italian? If $LanguageItalian = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Japanese? If $LanguageJapanese = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Dutch? If $LanguageDutch = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Portuguese (Brazilian)? If $LanguagePortugueseBrazilian = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Portuguese (Portugal)? If $LanguagePortuguesePortugal = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Polish? If $LanguagePolish = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Serbian? If $LanguageSerbian = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Slovak? If $LanguageSlovak = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Spanish? If $LanguageSpanish = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Danish? If $LanguageDanish = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: ChineseTraditional? If $LanguageChineseTraditional = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: ChineseSimplified? If $LanguageChineseSimplified = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Turkish? If $LanguageTurkish = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Russian? If $LanguageRussian = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Malay? If $LanguageMalay = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Korean? If $LanguageKorean = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: Indonesian? If $LanguageIndonesian = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Language: EnglishIndia? If $LanguageEnglishIndia = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install E-mail Scanner? If $EmailScanner = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Plugin for the Bat? If $PluginForTheBat = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Plugin for Microsoft Outlook? If $PluginForMicrosoftOutlook = 1 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install Personal Email Scanner? If $PersonalEmailScanner = 0 Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlSend("AVG 9.0", "Component Selection", 1011, "{DOWN}") ; Install MS Office Plugin? If $PluginForMicrosoftOffice = 1 And FileExists(@ProgramFilesDir & "\Microsoft Office") Then ControlSend("AVG 9.0", "Component Selection", 1011, "{SPACE}") EndIf ControlClick("AVG 9.0", "Component Selection", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Module Selection") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; AVG Datacenter If WinExists("AVG 9.0", "AVG DataCenter") and $Adlib[$i] <> 1 Then ControlSend("AVG 9.0", "AVG DataCenter", 1036, $DataCentre) ControlClick("AVG 9.0", "AVG DataCenter", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "AVG Datacentre") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; AVG Security Toolbar If WinExists("AVG 9.0", "AVG Security Toolbar") and $Adlib[$i] <> 1 Then If $SecurityToolbar = 1 Then ControlCommand("AVG 9.0", "AVG Security Toolbar", 1057, "Check") EndIf If $YahooSearch = 0 Then ControlCommand("AVG 9.0", "AVG Security Toolbar", 1060, "Check") EndIf ControlClick("AVG 9.0", "AVG Security Toolbar", 1000) If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Security Toolbar") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; While the long install process is happening, just pause If WinExists("AVG 8.0", "Installing supplementary files") Then WinWaitClose("AVG 8.0", "Installing supplementary files") If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Installing supplementary files") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 ; While the long install process is happening, just pause If WinExists("AVG 8.0", "Installing AVG...") Then WinWaitClose("AVG 8.0", "Installing AVG...") If $LogProgress = 1 Then FileWriteLine($ProgressLog, "Installing AVG...") $EscapeCounter = 0 $Adlib[$i] = 1 EndIf $i = $i + 1 EndFunc ; Deal with shortcuts If Not ($CopyDesktopIconTo = "") Then If Not FileExists($CopyDesktopIconTo) Then DirCreate($CopyDesktopIconTo) EndIf FileCopy(@DesktopCommonDir & "\AVG 9.0.lnk", $CopyDesktopIconTo) EndIf If $DeleteDesktopIcon = 1 Then FileDelete(@DesktopCommonDir & "\AVG 9.0.lnk") EndIf If Not ($CopyStartMenuFolderTo = "") Then If Not FileExists($CopyStartMenuFolderTo) Then DirCreate($CopyStartMenuFolderTo) EndIf DirCopy(@StartMenuCommonDir & "\Programs\AVG 9.0", $CopyStartMenuFolderTo) EndIf If $DeleteStartMenuFolder = 1 Then DirRemove(@StartMenuCommonDir & "\Programs\AVG 9.0", 1) EndIf ; Configuration Wizard ProcessWait("avgfrw.exe", 300) If $RunFirstRunWizard = 0 Then ProcessClose("avgfrw.exe") ElseIf WinWaitActive("AVG First Run Wizard", "AVG Update", 60) Then If $LogProgress = 1 Then FileWriteLine($ProgressLog, "AVG Update") ; updating takes ages. WinWaitClose("AVG First Run Wizard", "AVG Update") If WinWait("AVG First Run Wizard", "Schedule regular scans and updates", 5) Then If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Schedule regular scans and updates") ; How often would you like your AVG protection to be updated? ; Every 4 hours (recommended) If $UpdateFrequency = 1 Then ControlClick("AVG First Run Wizard", "Schedule regular scans and updates", 8811) EndIf ; Once a day If $UpdateFrequency = 2 Then ControlClick("AVG First Run Wizard", "Schedule regular scans and updates", 8813) EndIf ; When would you like your daily scan to take place? ; 1: Daily, 2: Weekly (recommended), 3: Never. If $ScheduledScan = 1 Then ControlClick("AVG First Run Wizard", "Schedule regular scans and updates", 8815) EndIf If $ScheduledScan = 2 Then ControlClick("AVG First Run Wizard", "Schedule regular scans and updates", 8818) EndIf If $ScheduledScan = 3 Then ControlClick("AVG First Run Wizard", "Schedule regular scans and updates", 8820) EndIf ; Set the time and day for the scan If $ScheduledScan <> 3 Then ; Time doesn`t apply to `never` $ScanTime1 = StringLeft($ScanTime, 2) $ScanTime2 = StringMid($ScanTime, 4 , 2) $ScanTime3 = StringRight($ScanTime, 2) ControlFocus("AVG First Run Wizard", "Schedule regular scans and updates", 8814) ControlSend("AVG First Run Wizard", "Schedule regular scans and updates", 8814, $ScanTime1) ControlSend("AVG First Run Wizard", "Schedule regular scans and updates", 8814, "{right}") ControlSend("AVG First Run Wizard", "Schedule regular scans and updates", 8814, $ScanTime2) ControlSend("AVG First Run Wizard", "Schedule regular scans and updates", 8814, "{right}") ControlSend("AVG First Run Wizard", "Schedule regular scans and updates", 8814, $ScanTime3) EndIf If $ScheduledScan = 2 Then ; Day only needs to be set for weekly scans ControlCommand("AVG First Run Wizard", "Schedule regular scans and updates", 8819, "SelectString", $ScanDay) EndIf ; Enable automatic scan of removable devices (e.g. USB drives, CD/DVD etc.) If $RemovableDevices = 1 Then ControlCommand("AVG First Run Wizard", "Schedule regular scans and updates", 8821, "Check", "") EndIf If $LogProgress > 0 Then FileWriteLine($ProgressLog, "schedules set, pressing next.") ; Next ControlClick("AVG First Run Wizard", "Schedule regular scans and updates", 5128) EndIf If WinWait("AVG First Run Wizard", "AVG protection configuration is complete", 5) Then If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Permit usage info") ; Please, help us improve our products by letting us collect completely anonymous scan and usage information from your computer. If $PermitUsageInfo = 0 Then ControlCommand("AVG First Run Wizard", "AVG protection configuration is complete", 8842, "UnCheck", "") EndIf ; Finish ControlClick("AVG First Run Wizard", "AVG protection configuration is complete", 5128) EndIf If WinWait("AVG Optimization Scan", "Optimize scanning performance", 5) Then If $LogProgress > 0 Then FileWriteLine($ProgressLog, "Optimization Scan") If $OptimizeNow = 1 Then ControlClick("AVG Optimization Scan", "Optimize scanning performance", 8903) Else ControlClick("AVG Optimization Scan", "Optimize scanning performance", 8904) EndIf EndIf EndIf If $LogProgress > 0 Then FileWriteLine($ProgressLog, "End" & @CRLF & @CRLF)