Sign in to follow this  
Followers 0
spiderblues

Updater for AV Personal

1 post in this topic

#1 ·  Posted (edited)

Hi there,

I wrote a little script for updating my AntiVir Programm (http://www.freeav.de/).

The AV Personal update can be scheduled, but after that, there comes a notifier window,

which offers the prof. product once a day.

Now I can put my little script into autostart, so every day the uptater is running,

and there is nothing to see or to click.

Ok, I know it would be possible with a popup blocker and scheduler, too, but I like it more

that way:

Opt("TrayAutoPause",0)
Opt("TrayMenuMode",1); No default menu

;#NoTrayIcon
#Include <GUIConstants.au3>
$TRAY_CHECKED       = 1
$TRAY_UNCHECKED     = 4
$TRAY_ENABLE        = 64
$TRAY_DISABLE       = 128
$TRAY_FOCUS     = 256
$TRAY_DEFAULT       = 512

$TRAY_EVENT_PRIMARYDOUBLE   = -13
$TRAY_EVENT_SECONDARYDOUBLE = -14

TraySetClick(16); only right (secondary) click will show the tray menu
$updater = IniRead("aviu.ini", "aviu", "updater", @ProgramFilesDir & "\AVPersonal\inetupd.exe")
$time = IniRead("aviu.ini", "aviu", "time", 10)
$time=$time*60*1000
$notifier = IniRead("aviu.ini", "aviu", "notifier", "avnotify.exe")

; Variables
Global $mainwnditem,$aboutitem,$exititem
Global $PID = "";

Opt("TrayIconHide", 0)      ;0=show, 1=hide tray icon

TrayPrepare()

If FileExists($updater) Then
    Run($updater, "", @SW_HIDE )
EndIf
;start timer
$begin = TimerInit()
While 1
    
    $PID = ProcessExists($notifier) 
    If $PID Then 
        ProcessClose($PID)
        Exit
    EndIf
    $traymsg= TrayGetMsg()
    $guimsg = GUIGetMsg()
    Select
        Case $traymsg = $exititem
            ExitLoop
            
        Case $traymsg = $aboutitem
            Msgbox(64,"Über AVinetUpater","AntiVirus Personal" & @CRLF & "Starten des Internet Updater mit automatischem schließen des Notifiers")
            
        Case $traymsg = $mainwnditem
            If FileExists($updater) Then
                Run($updater)
            EndIf
            
    EndSelect
    $dif = TimerDiff($begin) 
        if($dif > $time) Then Exit
WEnd

Exit
    
;*********************************************************************************************

; Tray Menu Preparing
Func TrayPrepare()  
    $mainwnditem        = TrayCreateItem("AnitVir Internet Update starten") 
    TrayCreateItem("")
    TrayItemSetState($mainwnditem,$TRAY_DEFAULT)
    $aboutitem          = TrayCreateItem("Über AVinetUpater")
    TrayCreateItem("")
    $exititem           = TrayCreateItem("AVinetUpater beenden")

EndFunc

The optional ini-file (aviu.ini):

;default values are used by the program without aviu.ini file
;updater = path to AVPersonal Internet Update Program (default: <ProgramFilesDir>\AVPersonal\inetupd.exe"
;time = minutes to wait after update for notifier window(default: 10)
;notifier = taskname in taskmanager for notifier window (default: avnotify.exe)

[aviu]
updater = C:\Programme\AVPersonal\inetupd.exe
time = 1
notifier = avnotify.exe

The wait time is for slow internet connections.

I'm not very good with that programming, so I hope you like it anyway...

Please excuse my english, too.

Peter

Edited by spiderblues

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