Sign in to follow this  
Followers 0
flyingboz

AVG Free

6 posts in this topic

#1 ·  Posted (edited)

Grisoft has a freeware a/v checker out there that has been getting some better at not screaming about false positives on au3 exes.

I got tired of having it in my system tray and clicking on its windows when it updated definitions, so I wrote this.

This enables me to easily force a a/v update, and prevents the control application from hogging RAM when it isn't doing anything immediately useful. Most gratifying, it prevents that 30 second window from annoying me, but speedily dismisses it.

Edit: Logic enhancements.

Func _UpdateAVG()
    Opt("WinTitleMatchMode",3)
    Local $reg, $pid
    $reg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "AVG7_CC")
    If Not StringLen($reg) Then
        $reg = @ProgramFilesDir & "\Grisoft\Avg Free\avgcc.exe"
    Else
        $reg = StringReplace($reg, "/STARTUP", '')
    EndIf
    If Not FileExists($reg) Then Return SetError(1, 0, 0)
    $pid = ProcessExists("avgcc.exe")
    If Not $pid Then $pid = Run($reg)
    
    If WinExists("AVG Free Edition - Control Center") Then WinActivate("AVG Free Edition - Control Center")
    WinWaitActive("AVG Free Edition - Control Center")
    ControlClick("AVG Free Edition - Control Center","Check for Updates",32791)
    Do
    
        Select
            Case WinActive("AVG Update")
                ;Updates are current, click OK and Exit.
                If WinActive("AVG Update") Then     ControlClick("AVG Update","OK",1)
                WinWaitNotActive("AVG Update")
                ExitLoop
            Case WinActive("AVG Free Edition Update Selection")
                ;Need to Update.
                ControlClick("AVG Free Edition Update Selection","Update",1)
            Case Else
                
        EndSelect
    Until 0=1
    
    ProcessClose($pid)
    _RefreshSystemTray()

EndFunc   ;==>_UpdateAVG


oÝ÷ ØÚ-y:槶ÊË^:ÚȬyµZ)7öÏÛEçëzÈRÊË^:ÚÉû§rب·©®nqç[zZ0N§ËhU©bú+¶¬{yا®±çîû§rب«­¢+Ø((()Õ¹}IÉÍ¡MåÍѵQÉä ÀÌØí¹±äôÄÀÀÀ¤($ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô($ì}IÉÍ¡MåÍѵQÉä ÀÌØí¹±äôÄÀÀÀ¤(ìÕÑ¡½ÈèY±¥¬¡¡ÑÑÀè¼½ÝÝܹÕѽ¥ÑÍÉ¥Áй½´½½ÉÕ´½¥¹à¹Á¡ÀýÌôµÀíÍ¡½ÝѽÁ¥ôÜÐÀеÀíÙ¥Üõ¥¹Á½ÍеÀíÀôÔÈÔÈ̤(ìIµ½Ù̹䥽¹Ìɽ´Ñ¡¹½Ñ¥¥Ñ¥½¸É¸(ìAɵÑÉÌè(ìÀÌØí¹±ä´%8½=AQ%=90´Q¡±äѼݥнÈÑ¡¹½Ñ¥¥Ñ¥½¸ÉѼáÁ¹Ý¥Ñ ]¥¹½ÝÌa@ÌäíÌ(ìÅÕ½Ðí!¥%¹Ñ¥Ù%½¹ÌÅÕ½ÐìÑÕÉ¡%¸µ¥±±¥Í½¹Ì¤¸(ìIÑÕɹÌè(ìMÑÌÉɽȽ¸¥±ÕÉè(ìÄ´QÉä½Õ±¸Ìäíнչ¸(ìÈ´±±
±°Éɽȸ(((ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ìMÙ=ÁÐÍÑÑ¥¹Ì(1½°ÀÌØí½±5Ñ¡5½ô=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°Ð¤(1½°ÀÌØí½±
¡¥±5½ô=ÁÐ ÅÕ½Ðí]¥¹MÉ¡
¡¥±É¸ÅÕ½Ðì°Ä¤(1½°ÀÌØíÉɽÈôÀ(¼ìAÍÕ¼±½½À(1½°ÀÌØí¡]¹ô]¥¹Ñ!¹± ÅÕ½Ðí±Í͹µõQÉå9½Ñ¥å]¹ÅÕ½Ðì¤(%ÉɽÈQ¡¸(ÀÌØíÉɽÈôÄ(á¥Ñ1½½À(¹%((1½°ÀÌØí¡
½¹Ñɽ°ô
½¹Ñɽ±Ñ!¹± ÀÌØí¡]¹°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí ÕÑѽ¸ÄÅÕ½Ðì¤((ì]Ìäíɽ¸a@¹Ñ¡!¥%¹Ñ¥Ù%½¹ÌÕÑѽ¸¥ÌѡɰͼáÁ¹¥Ð(%ÀÌØí¡
½¹Ñɽ°±ÐìÐìÅÕ½ÐìÅÕ½Ðì¹
½¹Ñɽ±
½µµ¹ ÀÌØí¡]¹°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¡
½¹Ñɽ°°ÅÕ½Ðí%ÍY¥Í¥±ÅÕ½Ðì¤Q¡¸(
½¹Ñɽ±
±¥¬ ÀÌØí¡]¹°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¡
½¹Ñɽ°¤(M±À ÀÌØí¹±ä¤(¹%((1½°ÀÌØíÁ½ÍMÑÉÐô5½ÕÍÑA½Ì ¤(1½°ÀÌØíÁ½Í]¥¸ô]¥¹ÑA½Ì ÀÌØí¡]¹¤((1½°ÀÌØíäôÀÌØíÁ½Í]¥¹lÅt(]¡¥±ÀÌØíä±ÐìÀÌØíÁ½Í]¥¹lÍt¬ÀÌØíÁ½Í]¥¹lÅt(1½°ÀÌØíàôÀÌØíÁ½Í]¥¹lÁt(]¡¥±ÀÌØíà±ÐìÀÌØíÁ½Í]¥¹lÉt¬ÀÌØíÁ½Í]¥¹lÁt(±±
±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÑ
ÕÉͽÉA½ÌÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíà°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíä¤(%ÉɽÈQ¡¸(ÀÌØíÉɽÈôÈ(á¥Ñ1½½ÀÌì)ÕµÀ½Õн]¡¥±½]¡¥±½¼(¹%(ÀÌØíàôÀÌØíà¬à(]¹(ÀÌØíäôÀÌØíä¬à(]¹(±±
±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMÑ
ÕÉͽÉA½ÌÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíÁ½ÍMÑÉÑlÁt°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíÁ½ÍMÑÉÑlÅt¤(ì]Ìäíɽ¸a@ͼݹѼ¡¥Ñ¡¥¹Ñ¥Ù¥½¹Ì¥¸¸(%ÀÌØí¡
½¹Ñɽ°±ÐìÐìÅÕ½ÐìÅÕ½Ðì¹
½¹Ñɽ±
½µµ¹ ÀÌØí¡]¹°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¡
½¹Ñɽ°°ÅÕ½Ðí%ÍY¥Í¥±ÅÕ½Ðì¤Q¡¸(
½¹Ñɽ±
±¥¬ ÀÌØí¡]¹°ÅÕ½ÐìÅÕ½Ðì°ÀÌØí¡
½¹Ñɽ°¤(¹%(U¹Ñ¥°Ä((ìIÍѽÉ=ÁÐÍÑÑ¥¹Ì(=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°ÀÌØí½±5Ñ¡5½¤(=ÁÐ ÅÕ½Ðí]¥¹MÉ¡
¡¥±É¸ÅÕ½Ðì°ÀÌØí½±
¡¥±5½¤(MÑÉÉ½È ÀÌØíÉɽȤ)¹Õ¹ì}IÉÍ¡MåÍѵQÉä ¤(
Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites



Nice. Have you noticed that sometimes during the update process Grisoft's server is experiencing difficulties? Or after the priority updates are downloaded and installed, you can go back immediately and download/install "optional" updates? I've tried to account for these events in the following script:

Update()

While 1
  If WinExists('AVG Free Edition Update Selection', 'Please select update') Then
    ControlClick('AVG Free Edition Update Selection', 'Please select update', 'Button2')
  ElseIf WinExists ('AVG Free Edition', 'Update was successfully finished') Then
    ControlClick('AVG Free Edition', 'Update was successfully finished', 'Button1')
    Update()
  Else
    If WinExists('Update AVG', 'An error occurred when trying to connect') Then
        ControlClick('Update AVG', 'An error occurred when trying to connect', 'Button1')
    ElseIf WinExists('AVG Update', 'Your AVG program already has the latest updates installed') Then
        ControlClick('AVG Update', 'Your AVG program already has the latest updates installed', 'Button1')
        Exit
    EndIf
  EndIf
    Sleep(40)
WEnd
    
Func Update()
  $var = Ping('guru.grisoft.com')
  If $var Then 
    Run(@Programfilesdir & '\Grisoft\AVG Free\avginet.exe')
  Else
    Exit
  EndIf
EndFunc

"No peace for the wicked, no rest for the good."

Share this post


Link to post
Share on other sites

You can get to the update process directly via "avginet.exe."

Nice code by the way--it works!

...and I may add this to my home computers Automated Processes Manager.

Share this post


Link to post
Share on other sites

Works for me.

Thanks.

llamnuds

Share this post


Link to post
Share on other sites

You can get to the update process directly via "avginet.exe."

Yes -- If you've got the machine configured not to run the avgcc on startup (deleted the run reg key) , and still want updates to operate, you can do it that way -- but I wanted to have a way of dealing with killing the control center anyway, but didn't want to hack the registry.

Nice code by the way--it works!

...and I may add this to my home computers Automated Processes Manager.

Thank you, you are more than welcome to use the code how you wish.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Nice. Have you noticed that sometimes during the update process Grisoft's server is experiencing difficulties? Or after the priority updates are downloaded and installed, you can go back immediately and download/install "optional" updates? I've tried to account for these events in the following script:

Update()

While 1
  If WinExists('AVG Free Edition Update Selection', 'Please select update') Then
    ControlClick('AVG Free Edition Update Selection', 'Please select update', 'Button2')
  ElseIf WinExists ('AVG Free Edition', 'Update was successfully finished') Then
    ControlClick('AVG Free Edition', 'Update was successfully finished', 'Button1')
    Update()
  Else
    If WinExists('Update AVG', 'An error occurred when trying to connect') Then
        ControlClick('Update AVG', 'An error occurred when trying to connect', 'Button1')
    ElseIf WinExists('AVG Update', 'Your AVG program already has the latest updates installed') Then
        ControlClick('AVG Update', 'Your AVG program already has the latest updates installed', 'Button1')
        Exit
    EndIf
  EndIf
    Sleep(40)
WEnd
    
Func Update()
  $var = Ping('guru.grisoft.com')
  If $var Then 
    Run(@Programfilesdir & '\Grisoft\AVG Free\avginet.exe')
  Else
    Exit
  EndIf
EndFunc
Is anyone using this script? I tried it and it hangs. I tried adding winactivate, winwaitactive, control focus, and finally winwaitclose to each case, but it still hangs. I tried increasing the sleep time.

I call this function after installing AVG via a script, before running AVGSCAN.EXE via winwait with line commands to scan in a dos window. All three steps are done in one script: install, update, run.

I am using the installation program from Grisoft's site, named avg75free_467a1008.exe

The update downloads and then AVG starts to install the update and that's where it hangs. I always have to turn off the PC at that point. I can't escape from the script, even with an ESC hotkey, nor can I use the task manager to cancel the task, or control+alt+delete. I have to push the off button and hold it until the PC shuts down.

My final code after making changes to try and stop the hanging looks like this:

Func Update_AVG()
    Local $Done = False
    
    Run(@Programfilesdir & "\Grisoft\AVG7\avginet.exe")

    While Not $Done
        If WinExists("AVG Free Edition Update Selection", "Please select update") Then
            WinActivate("AVG Free Edition Update Selection")
            WinWaitActive("AVG Free Edition Update Selection", "Please select update")
            ControlFocus("AVG Free Edition Update Selection","","Button2")
            ControlClick("AVG Free Edition Update Selection", "Please select update", "Button2")
            WinWaitClose("AVG Free Edition Update Selection")
        ElseIf WinExists ("AVG Free Edition", "Update was successfully finished") Then
            WinActivate("AVG Free Edition")
            WinWaitActive("AVG Free Edition", "Update was successfully finished")
            ControlFocus("AVG Free Edition","","Button1")
            ControlClick("AVG Free Edition", "Update was successfully finished", "Button1")
            WinWaitClose("AVG Free Edition")
            Run(@Programfilesdir & "\Grisoft\AVG7\avginet.exe")
        ElseIf WinExists("Update AVG", "An error occurred when trying to connect") Then
            WinActivate("Update AVG")
            WinWaitActive("Update AVG", "An error occurred when trying to connect")
            ControlFocus("Update AVG","","Button1")
            ControlClick("Update AVG", "An error occurred when trying to connect", "Button1")
            WinWaitClose("Update AVG")
            $Done = True
        ElseIf WinExists("AVG Update", "Your AVG program already has the latest updates installed") Then
            WinActivate("AVG Update")
            WinWaitActive("AVG Update", "Your AVG program already has the latest updates installed")
            ControlFocus("AVG Update","","Button1")
            ControlClick("AVG Update", "Your AVG program already has the latest updates installed", "Button1")
            WinWaitClose("AVG Update")
            $Done = True
        Else
            Sleep(5000)
            ContinueLoop
        EndIf
    WEnd
    
EndFunc

The guru.grisoft.com does not respond to a ping, so I removed it from the script.

This would be a great way to make sure the AVG virus database is up to date before running the scan, but I am not able to get it to not hang when I run the entire script.

Finally, I added this to the XPClean script, which is where I am running it from.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0