;***************************************************************** ; ; Program : Avast Helper ; Coder : Adam Kaminski (TeknoMusicMan) ; Tested on : avast! version 4.6 Home Edition, Build: Apr2005 (4.6.652) ; ; Please Send a Private Message to TeknoMusicMan on ; the www.AutoHotkey.com Forums if you have found it ; to work on other Builds ; ; I wrote Avast Helper because I wanted the ability to have a Scheduled Task ; to run Avast without paying for the Professional version of their software. ; ; I also wrote the script for fun. ; Yes it would have been easier to crack the Professional Version :P ; ; USING THE SCRIPT ; If you are on a Dial-up connection you should set it so that ; the computer will automatically dial your ISP when a program ; tries to access the internet. ; ; If you donot wish to do this or you just don't want it to update ; Set Update = 0 ; ; If you installed your Avast into non-standard folders adjust the ; iniPath and exePath variables to the correct locations ; ; WHAT THE SCRIPT DOES ; The Script will open up the avast scanner with the skins disabled ; it will then check for updates if update = 0. After it is ; finished updating it will then check local hard disks, ; Test Archives on the Thorough Setting, and then click Star scan. ; ; During the scan process if a virus is detected it will "Delete All" ; ; It will also deny repeated Email Alerts from going out if you ; have any set ; ; The script will then exit when the scan has finished ; ;***************************************************************** ;***************************************************************** ; CONFIG Update = 1 ; DO NOT include the trailing \ on the path's iniPath = %A_ProgramFiles%\Alwil Software\Avast4\DATA exePath = %A_ProgramFiles%\Alwil Software\Avast4 ; ;***************************************************************** #Persistent #SingleInstance ignore Menu, TRAY, Tip, Avast Helper Menu, TRAY, NoStandard Menu, TRAY, NoDefault Menu, TRAY, Add, Exit, Exit ; Turned on the DectectHidden Options incase the computer were to be locked during the process ; I'm not even positive that when the computer is locked the windows are "Hidden" ; I set it as a precaution more then anything. DetectHiddenText, On DetectHiddenWindows, On ; This variable is used in the WindowWatch Sub Started = 0 IfExist, %iniPath%\avast4.ini ; Checks To See if the IniFile is Present { ; Reads the StartWithSkin Key Value into the Original Variable ; so the script can set it back when it is finished running. iniRead, Original, %iniPath%\avast4.ini, UserInterface, StartWithSkin sleep 100 ; Writes a value of 0 into the StartWithSkin key so that the scripts Control Commands Work. iniWrite, 0, %iniPath%\avast4.ini, UserInterface, StartWithSkin } Else { ; Displays a Message Box stating that the IniFile coulnd not be found MsgBox, , Avast Helper, Ini File Not Found } sleep 100 IfExist, %exePath%\ashAvast.exe ; Checks to see if the ashAvast Executable is Present { ; Opens the Avast Antivirus Program Run, %exePath%\ashAvast.exe } Else { ; Displays a Message Box if the Avast Antivirus Program wasn't found it. MsgBox, , Avast Helper, File Not Found.`nClosing Program. ; Exits the script ExitApp } ; Starts the timers that continously watch for specific windows. SetTimer, Virus, 100 SetTimer, Message, 100 ; The Avast Antivirus Program starts out scanning the memory ; So the script waits until the memory scan is complete and ; the Simple User Interface window is present WinWait, avast! Simple User Interface, SetTimer, WindowWatch, 1000 If Update = 1 { ; Sends a command to the Simple User Interface to update its iAVS definition files. PostMessage, 0x111, 667, 0, , avast! Simple User Interface ; Waits for the iAVS update window to be finished ; then clicks on the Close button of the summary window WinWait, avast! Antivirus Setup, Summary, , , Downloading Packages ControlClick, &Close, avast! Antivirus Setup } ; I sent each of the following commands twice because ; every now and again it would skip one even with ; the sleeps in there. ; Checks the Local Hard Disks's checkbox Control, Check, , &Local Hard Disks, avast! Simple User Interface Control, Check, , &Local Hard Disks, avast! Simple User Interface sleep 100 ; Checks the Test Archives checkbox Control, Check, , Test archi&ves, avast! Simple User Interface Control, Check, , Test archi&ves, avast! Simple User Interface sleep 100 ; Sets the highest level of scanning inside archives ControlClick, Thorou&gh, avast! Simple User Interface ControlClick, Thorou&gh, avast! Simple User Interface sleep 100 ; Starts the Scanner ControlClick, Start sc&an, avast! Simple User Interface ControlClick, Start sc&an, avast! Simple User Interface ; This variable is used in the WindowWatch Sub Started = 1 Return Virus: { ; Checks to see if a Virus was found popup exists IfWinExist, avast! Warning, A Virus Was Found! { sleep 100 ; Clicks the Delete Button on the popup ControlClick, &Delete..., avast! Warning ; Waits for the Delete files confirmation window WinWait, Delete file(s)... sleep 100 ; Clicks on the Delete All button ControlClick, &Delete all, Delete file(s)... } return } Message: { ; If you have any SMTP Alerts setup and the scanner has found ; many virus's you may get a warning message stating that ; repeated identical message's are being sent out IfWinExist, avast! Virus warning, Suspicious Message! { sleep 100 ; Clicks the "Don't send!" button ; I did this because the scanner has already sent ; out a few warnings and there is no reason to ; keep sending the same warnings even more. ControlClick, Don't send!, avast! Virus warning } return } WindowWatch: { ; Checks to see if the Simple user interface window is gone IfWinNotExist, avast! Simple User Interface { ; If the Simple User Interface window is gone, the ; script will exit GoSub, Exit } ; Checks to see if the Results window is present IfWinExist, Results of last scan { ; Exits the Script if the Results window is present GoSub, Exit } IfWinNotExist, Results of last scan { ; Checks to see if the "Stop Scan" and "Go to Background" buttons greyed out. ControlGet, stopScan, Enabled, , St&op scan, avast! Simple User Interface ControlGet, gotoBackground, Enabled, , Go to &Background, avast! Simple User Interface ; The Started variable is used so that this if statement isn't true before ; the scan has been started by the script ; If the started variable is 1 and both buttons are greyed out that means ; the script started the scan so it is now finished. if (Started = 1 AND stopScan = 0 AND gotoBackground = 0) { ; The Timers are turned off so they arn't eating up system resources. SetTimer, Virus, off SetTimer, Message, off SetTimer, WindowWatch, off MsgBox, , Avast Helper, The scan finished, no virus's were found. GoSub, Exit } } return } Exit: { ; Set's the Ini File's original value to the StartWithSkin key incase the user uses avast's ugly skins :P iniWrite, %Original%, %A_ProgramFiles%\Alwil Software\Avast4\DATA\avast4.ini, UserInterface, StartWithSkin sleep 100 ExitApp return }
What I do is i compile the script and then create a scheduled task from the control panel and have this run at whatever time i want. I did this instead of making the script something that is running all the time and checks the time for when to run. This saves on system resources.
Some of the lines in the code are long so beware of the Forum's word wrapping issue. If you use IE I don't think that problem occurs
Please Tell me what you think.