Sign in to follow this  
Followers 0
NDog

Spybot S&D Automation Help

2 posts in this topic

Hi there, this is my first post. Please excuse my bad english and unknown to this field.

I have this script which extremely buggy, since I have only used Autoit for 1 week now and have trouble understanding the language, but I have improved greatly by reading other users posts

My script is an all in one feature since I work as a computer technician I want it to automatically run spybot and then scan the system and fix it then close.

I have managed to make it get up to the scan part so far, however there is no visible window info when I use the Windows Info tool in the part where spybot says &Fix Selected Items, so I don't know how to make a condition for that.

If anyone has free time to bother looking at my primitive code I would be honored, but hopefully other people will get use out of an all in one spybot s&d automatied script

Thanks

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.4.9
 Author:         NDog

 Script Function:
    - Update Spybot S & D through Internet
    - Launch Spybot S & D
    - Close all the startup annoying popup boxes
    - Immunize the system
    - Run Full Scan
    - Fix Selected Problems
    - Restart Computer if neccesary with another script automating the startup scan
    
#ce ----------------------------------------------------------------------------

; Debug & Exit Misc
Opt("TrayIconDebug", 1)
$g_szVersion = "NDogS&Dallin1"
If WinExists($g_szVersion) Then Exit; It's already running
AutoItWinSetTitle($g_szVersion)
HotKeySet("{ESC}", "MyExit")
Func MyExit()
    Exit
EndFunc

; Script Parameters
$msgboxtitle = "WARNING - you have been warned"
$installdir = @ProgramFilesDir & "\Spybot - Search & Destroy"
$updateexec = "SDUpdate.exe"
$programexec = "SpybotSD.exe"

$updatertitle = "Spybot-S&D Updater"

;MsgBox(0,$msgboxtitle,$installdir)

; Check Spybot is installed
If Not FileExists($installdir & "\SDHelper.dll") Then 
    MsgBox(0,$msgboxtitle, "I can't find this %#$@ installed at " & $installdir & @CRLF & ". Obviously yourstruly programing skills arent that good to enum the regeditsry and look there yet, but they will be one day! I am quitting, bye!")
    Exit
EndIf

; Update Spybot S & D
$update = False

$var = Ping("www.google.com", 250)
If @error > 0 Then
    $answer = Msgbox(4,$msgboxtitle,"Automatic Updates not working" & @CRLF & "Cannot establish an internet connection.  Error: " & @error & @CRLF & "Would you you like to continue with Spybot Launch and scan?", 5)
        If $answer = 7 Then
            Exit
        EndIf
    $update = True
EndIf

If $update = False Then
    Run($installdir & "\" & $updateexec)
        WinWait($updatertitle)
        WinActivate($updatertitle)
        Send("!s")
EndIf

While $update = False
    If WinExists("Information") Then
        $title = "Information"
        WinActivate($title)
        WinWaitActive($title)
        ControlFocus($title, "", "TButton1")
        ControlClick($title, "", "TButton1")
        update()
        $update = True
    ElseIf WinExists("nul") Then
        $title = "nul"
        WinActivate($title)
        WinWaitActive($title)
        ControlFocus($title, "", "TButton1")
        ControlClick($title, "", "TButton1")
        update()
        $update = True
    Else
        Sleep(500)
        ContinueLoop
    EndIf
WEnd

Func update()
    WinWait($updatertitle)
    WinActivate($updatertitle)
    Send("!x")
EndFunc

; Launch Spybot S & D
RegWrite("HKEY_CURRENT_USER\Software\Safer Networking Limited\SpybotSnD", "WizardRun", "REG_DWORD", "1")
Run($installdir & "\" & $programexec)
$title = "Spybot - Search & Destroy"
WinWait($title)
WinActivate($title)
Send("!i")
WinWait($title, "Permanently running bad download blocker for Internet Explorer")
$immunize = False
    While $immunize = False
        If WinExists("Warning") Then
            $title = "Warning"
            WinActivate($title)
            WinWaitActive($title)
            ControlFocus($title, "", "TButton1")
            ControlClick($title, "", "TButton1")
            Send("!i")
            Sleep(2000)
            Send("!a")
        ElseIf WinExists("Information","OK") Then
            $title = "Information"
            WinActivate($title,"OK")
            WinWaitActive($title,"OK")
            ControlFocus($title, "OK", "TButton1")
            ControlClick($title, "OK", "TButton1")
            $immunize = True
        Else
            Sleep(2000)
            ContinueLoop
        EndIf
    WEnd

; Fix Spybot S & D
#cs
Spybot - Search & Destroy
3 problems found (13:47)
No information available
Send("!f")
#ce
Send("!f")
Send("c")

$scan = True
    While $scan = True
        Opt("WinTitleMatchMode", 2); Match substring
        If WinExists("Spybot - Search & Destroy", "problems found") Then 
            $title = "Spybot - Search & Destroy"
            WinActivate($title,"Yes")
            WinWaitActive($title,"Yes")
            Send("!f")
        ElseIf WinExists("Confirmation", "Yes") Then
            $title = "Confirmation"
            WinActivate($title,"Yes")
            WinWaitActive($title,"Yes")
            ControlFocus($title, "Yes", "TButton2")
            ControlClick($title, "Yes", "TButton2")
        ElseIf WinExists("Confirmation", "OK") Then
            $title = "Confirmation"
            WinActivate($title,"OK")
            WinWaitActive($title,"OK")
            ControlFocus($title, "OK", "TButton2")
            ControlClick($title, "OK", "TButton2")
            $scan = False
        Else
            Sleep(2000)
            ContinueLoop
        EndIf
    WEnd

MsgBox(0,$msgboxtitle,"Finished doing my thang - its laters bro in 15 seconds",15)

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