Jump to content

Updater and Maintenance tool


philphil61
 Share

Recommended Posts

My first major script (tested on Win7 32) but also compiled to run on Win7 64 & XP (hopefully)

Please feel free to criticise, comment or advise

It's "tasks" to check if installed, if not installed then install, then run several updaters and cleaning applications then defrag.

Runs

Windows Update, FileHippo Update Checker, CNET Tech Tracker, Secunia PSI - to make sure all software installed is up to date.

CCleaner, Wise Registry Cleaner, Wise Disk Cleaner, 360 Amigo Speedup, MyDefrag(SystemDiskMonthly)

I've used most of these applications for months and help a few friends with maintaining their pc's/laptops via teamviewer and wanted to ease the workload and create a "one click" update/maintenance tool.

#include <IE.au3>
if FileExists(@AppDataDir & "\CBS Interactive\CNET TechTracker\TechTracker.exe") Then
Sleep(10)
Else
InetGet("http://dl.dropbox.com/u/4608274/CNET_TechTracker_2_0_4_Setup.exe", @DesktopCommonDir & "\CNET_TechTracker_2_0_4_Setup.exe", 0, 0)
Run(@DesktopCommonDir & "\CNET_TechTracker_2_0_4_Setup.exe")
WinWaitActive("CNET TechTracker ")
If WinExists("CNET TechTracker ")Then
WinActivate("CNET TechTracker ")
Send("{SPACE}")   
Sleep(300)
ControlClick("CNET TechTracker ", "I &accept the terms of the License Agreement", "[CLASS:Button; INSTANCE:4]")
Sleep(300)
Send("{TAB 2}")
Sleep(100)
Send("{SPACE}")
Sleep(300)
MsgBox(1, "Extras", "Click Do Not Install PC Speed Up - then click Install   -  click OK after completeing to continue", 0)
Sleep(4000)
WinActive("CNET TechTracker ")
WinWaitActive("CNET TechTracker ")
WinActivate("CNET TechTracker ")
Sleep(6000)
Send("{TAB 2}")
Sleep(100)
Send("{SPACE}")
Sleep(300)
Send("{TAB}")
Sleep(100)
Send("{SPACE}")
EndIf
FileDelete(@DesktopCommonDir & "\CNET_TechTracker_2_0_4_Setup.exe")
FileDelete(@DesktopCommonDir & "\CNET TechTracker.lnk")
FileDelete(@DesktopDir & "\CNET TechTracker.lnk")
EndIf
If FileExists(@ProgramFilesDir & "\Wise Registry Cleaner\WiseRegCleaner.exe") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\Wise Registry Cleaner\WiseRegCleaner.exe") Then
Sleep(30)
Else
InetGet("http://dl.dropbox.com/u/4608274/WRCFree.exe", @DesktopCommonDir & "\WRCFree.exe", 0, 0)
Run(@DesktopCommonDir & "\WRCFree.exe")
WinWait("Setup - Wise Registry Cleaner")
WinWaitActive("Setup - Wise Registry Cleaner")
If WinExists("Setup - Wise Registry Cleaner") Then
Send("{SPACE}")
Sleep(300)
Send("{Tab}")
Send("{UP}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 3}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{SPACE}")
Sleep(8000)
ControlClick("Setup - Wise Registry Cleaner", "&Next >", "[CLASS:TNewButton; INSTANCE:4]")
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Send("{Tab 2}")
Send("{SPACE}")
Run(@ProgramFilesDir & "\Wise Registry Cleaner\WiseRegCleaner.exe")
WinWait("Notice")
ControlClick("Notice", "Don't show this window again.", "[CLASS:TbsSkinCheckRadioBox; INSTANCE:1]")
Send("{Tab 2}")
Send("{SPACE}")
WinWait("Backup")
MsgBox(1, "Registry Backup", "Click Create full registry backup then click OK", 0)
WinWait("Wise Registry Cleaner")
WinWaitClose("Registry Backup")
Sleep(2000)
WinWait("Settings")
MsgBox(1, "Click Settings", "Click Settings button and press OK ", 0)
Sleep(4000)
WinWaitActive("Settings")
WinActive("Settings")
Send("{Tab}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 3}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{n}")
ControlClick("Settings", "OK", "[CLASS:TbsSkinButton; INSTANCE:7]")
Sleep(500)
WinClose("Wise Registry Cleaner")
EndIf
FileDelete(@DesktopCommonDir & "\WRCFree.exe")
FileDelete(@DesktopCommonDir & "\Wise Registry Cleaner.lnk")
EndIf
If FileExists(@ProgramFilesDir & "\Wise Disk Cleaner\WiseDiskCleaner.exe") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\Wise Disk Cleaner\WiseDiskCleaner.exe") Then
Sleep(30)
Else
InetGet("http://dl.dropbox.com/u/4608274/WDCFree.exe", @DesktopCommonDir & "\WDCFree.exe", 0, 0)
Run(@DesktopCommonDir & "\WDCFree.exe")
WinWait("Setup - Wise Disk Cleaner")
If WinExists("Setup - Wise Disk Cleaner") Then
Send("{SPACE}")
Sleep(500)
Send("{Tab}")
Send("{UP}")
Sleep(500)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(500)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(500)
Send("{Tab 3}")
Send("{SPACE}")
Sleep(500)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(500)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(500)
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Sleep(500)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(500)
Send("{SPACE}")
Sleep(8000)
ControlClick("Setup - Wise Disk Cleaner", "&Next >", "[CLASS:TNewButton; INSTANCE:4]")
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Send("{Tab 2}")
Send("{SPACE}")
Run(@ProgramFilesDir & "\Wise Disk Cleaner\WiseDiskCleaner.exe")
WinWait("Settings")
MsgBox(1, "Click Settings", "Click Settings button and press OK ", 0)
Sleep(3000)
WinActivate("Settings")
Send("{Tab}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{n}")
Sleep(300)
ControlClick("Settings", "OK", "[CLASS:TbsSkinButton; INSTANCE:11]")
Sleep(500)
WinClose("Wise Disk Cleaner")
EndIf
FileDelete(@DesktopCommonDir & "\WDCFree.exe")
FileDelete(@DesktopCommonDir & "\Wise Disk Cleaner.lnk")
EndIf
If FileExists(@ProgramFilesDir & "\360Amigo\360Amigo.exe") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\360Amigo\360Amigo.exe") Then
Sleep(30)
Else
InetGet("http://dl.dropbox.com/u/4608274/360amigofreesetup.exe", @DesktopCommonDir & "\360amigofreesetup.exe", 0, 0)
Run(@DesktopCommonDir & "\360amigofreesetup.exe")
Sleep(2000)
MsgBox(1, "Install 360Amigo", "Click Create System Restore and uncheck Launch Program then click Accept and Install - please click OK after complete", 0)
Sleep(15000)
WinWait("360amigo: Thank you for installing 360Amigo")
WinClose("360amigo: Thank you for installing 360Amigo")
ProcessClose("360Amigo.exe")
FileDelete(@DesktopCommonDir & "\360amigofreesetup.exe")
FileDelete(@DesktopDir & "\360Amigo System Speedup.lnk")
EndIf
if FileExists (@ProgramFilesDir & "\FileHippo.com\UpdateChecker.exe") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\FileHippo.com\UpdateChecker.exe") Then
Sleep(30)
Else
InetGet("http://www.filehippo.com/updatechecker/FHSetup.exe", @DesktopCommonDir & "\FHSetup.exe", 0, 0)
Run(@DesktopCommonDir & "\FHSetup.exe")
WinWait("Installer Language")
ControlClick("Installer Language", "OK", "[CLASS:Button; INSTANCE:1]")
Sleep(300)
WinWait("FileHippo.com Update Checker Setup")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{DOWN}")
Send("{SPACE}")
Sleep(300)
Send("{DOWN}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 3}")
Send("{SPACE}")
Sleep(3000)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(1000)
ProcessClose("UpdateChecker.exe")
FileDelete(@DesktopCommonDir & "\FHSetup.exe")
FileDelete(@DesktopCommonDir & "\Update Checker.lnk")
EndIf
if FileExists(@ProgramFilesDir & "\Secunia\PSI\psi.exe") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\Secunia\PSI\psi.exe") Then
Sleep(30)
Else
InetGet("ftp://ftp.secunia.com/PSISetup.exe", @DesktopCommonDir & "\PSISetup.exe", 0, 0)
Run(@DesktopCommonDir & "\PSISetup.exe")
WinWait("PSI Setup")
Send("{SPACE}")
Sleep(500)
Send("{Tab}")
Send("{SPACE}")
Sleep(200)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(200)
ControlClick("PSI Setup", "Enable Auto-Updates", "[CLASS:Button; INSTANCE:4]")
Sleep(200)
Send("{Tab 3}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 2}")
Send("{SPACE}")
Sleep(300)
Send("{Tab 3}")
Send("{SPACE}")
Sleep(6000)
Send("{SPACE}")
Sleep(500)
Send("{Tab}")
Send("{SPACE}")
FileDelete(@DesktopCommonDir & "\PSISetup.exe")
FileDelete(@DesktopCommonDir & "\Secunia PSI.lnk")
ProcessClose("psi_tray.exe")
EndIf
IF FileExists(@ProgramFilesDir & "\CCleaner\CCleaner.exe") Then
Sleep(30)
ElseiF FileExists(@ProgramFilesDir & "\CCleaner\CCleaner64.exe") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\CCleaner\CCleaner.exe") Then
Sleep(30)
Else
InetGet("http://dl.dropbox.com/u/4608274/ccsetup312.exe", @DesktopCommonDir & '\ccsetup312.exe', 0, 0)
Run(@DesktopCommonDir & "\ccsetup312.exe")
Sleep(2000)
ControlClick("Installer Language", "OK", "[CLASS:Button; INSTANCE:1]")
Sleep(300)
WinWait("CCleaner ")
Send("{SPACE}")
Sleep(300)
Send("{TAB 2}")
Send("{SPACE}")
Sleep(300)
Send("{TAB 3}")
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Send("{DOWN}")
Send("{SPACE}")
Sleep(500)
Send("{TAB 2}")
Send("{SPACE}")
Sleep(7000)
Send("{SPACE}")
Send("{TAB}")
Send("{SPACE}")
Sleep(1000)
Send("{TAB}")
Send("{SPACE}")
FileDelete(@DesktopCommonDir & "\ccsetup312.exe")
FileDelete(@DesktopCommonDir & "\CCleaner.lnk")
EndIf
if FileExists(@ProgramFilesDir & "\MyDefrag v4.3.1\Scripts\SystemDiskMonthly.MyD") Then
Sleep(30)
ElseIf FileExists(@HomeDrive & "\Program Files\MyDefrag v4.3.1\Scripts\SystemDiskMonthly.MyD") Then
Sleep(30)
Else
InetGet("http://www.mydefrag.com/Downloads/Download.php?File=MyDefrag-v4.3.1.exe", @DesktopCommonDir & "\MyDefrag-v4.3.1.exe", 0, 0)
Run(@DesktopCommonDir & "\MyDefrag-v4.3.1.exe")
WinWait("Select Setup Language")
WinActivate("Select Setup Language")
ControlClick("Select Setup Language", "OK", "[CLASS:TNewButton; INSTANCE:1]")
Sleep(300)
Send("{SPACE}")
Sleep(500)
Send("{TAB}")
Send("{UP}")
Sleep(300)
Send("{TAB 2}")
Send("{SPACE}")
Sleep(300)
Send("{TAB 3}")
Send("{SPACE}")
Sleep(300)
Send("{DOWN 3}")
Send("{SPACE}")
Sleep(300)
Send("{DOWN 2}")
Send("{SPACE}")
Sleep(300)
Send("{TAB 2}")
Send("{SPACE}")
Sleep(300)
Send("{TAB 4}")
Send("{SPACE}")
Sleep(300)
Send("{SPACE}")
Sleep(300)
Send("{DOWN 2}")
Send("{SPACE}")
Sleep(300)
Send("{TAB 2}")
Send("{SPACE}")
Sleep(300)
Send("{SPACE}")
Sleep(4000)
Send("{SPACE}")
FileDelete(@DesktopCommonDir & "\MyDefrag-v4.3.1.exe")
FileDelete(@DesktopCommonDir & "\MyDefrag-v4.3.1.lnk")
EndIf
if FileExists (@SystemDir & "\wuapp.exe") Then
Run(@SystemDir & "\wuapp.exe")
Else
Run(@SystemDir & "\wupdmgr.exe")
EndIf
WinWaitActive ("Windows Update")
Sleep(3000)
ControlClick("Windows Update", "&Check for updates", "[CLASS:Button; INSTANCE:3]")
WinWaitClose ("Windows Update")
If FileExists(@ProgramFilesDir & "\FileHippo.com\UpdateChecker.exe") Then
Run(@ProgramFilesDir & "\FileHippo.com\UpdateChecker.exe")
Else
Run(@HomeDrive & "\Program Files\FileHippo.com\UpdateChecker.exe")
EndIf
If ProcessExists("UpdateChecker.exe") Then
    Sleep(2000)
EndIf
MsgBox(1, "Check FileHippo Updates", "Download and install any", 0)
if WinExists ("FileHippo.com - Download Free Software ") Then
WinWaitClose ("FileHippo.com - Download Free Software ")
EndIf
Run(@AppDataDir & "\CBS Interactive\CNET TechTracker\TechTracker.exe")
Sleep(6000)
MsgBox(1, "Check CNET Tracker", "Click OK when all CNET Tracker updates are done or no updates required", 0)
If FileExists (@ProgramFilesDir & "\Secunia\PSI\psi.exe") Then
Run(@ProgramFilesDir & "\Secunia\PSI\psi.exe")
Else
Run(@HomeDrive & "\Program Files\Secunia\PSI\psi.exe")
EndIf
Sleep(10000)
MsgBox(1, "Secunia", "You are looking for 100% results after scan Click OK when 100%", 0)
ProcessClose("TechTracker.exe")
IF FileExists(@ProgramFilesDir & "\CCleaner\CCleaner.exe") Then
RunWait(@ProgramFilesDir & "\CCleaner\CCleaner.exe /AUTO")
ElseiF FileExists(@ProgramFilesDir & "\CCleaner\CCleaner64.exe") Then
RunWait(@ProgramFilesDir & "\CCleaner\CCleaner64.exe /AUTO")
Else
RunWait(@HomeDrive & "\Program Files\CCleaner64.exe /AUTO")
EndIf
RunWait(@ProgramFilesDir & "\Wise Registry Cleaner\WiseRegCleaner.exe -a -all")
RunWait(@ProgramFilesDir & "\Wise Disk Cleaner\WiseDiskCleaner.-a -all")
if FileExists(@ProgramFilesDir & "\360Amigo\360Amigo.exe") Then
Run(@ProgramFilesDir & "\360Amigo\360Amigo.exe")
Else
Run(@HomeDrive & "\Program Files\360Amigo\360Amigo.exe")
EndIf
WinWait("360Amigo System Speedup")
WinWaitActive("360Amigo System Speedup")
Sleep(2000)
Send("{TAB 8}")
Send("{ENTER}")
Sleep(60000)
Send("{TAB 8}")
Send("{ENTER}")
Sleep(180000)
ProcessClose("360Amigo.exe")
If FileExists(@ProgramFilesDir & "\MyDefrag v4.3.1\MyDefrag.exe -r SystemDiskMonthly.MyD") Then
Run(@ProgramFilesDir & "\MyDefrag v4.3.1\MyDefrag.exe -r SystemDiskMonthly.MyD")
Else
Run(@HomeDrive & "\Program Files\MyDefrag v4.3.1\MyDefrag.exe -r SystemDiskMonthly.MyD")
EndIf
Exit

There are other functions on some of the software like Wise Disk Cleaner's "Slimming System" that I want to build into the script but................I'm still learning and testing :D

Edited by philphil61
Link to comment
Share on other sites

Hi

I like it but i would like to see either a small gui or even a tray notification to see where the script is upto and even that its running or finished. Look at either Koda for creating your Gui or traytip in the help file as a start. But just a suggestion.

Well done on first major script

Drunken Frat-Boy Monkey Garbage

Link to comment
Share on other sites

One non Autoit thing first, I would suggest for machines running Windows 7 to have the disk defrag' run as a scheduled task if at all possible. I recently setup a large number of Win7 machines and the defrag is set to run everyday at 12 noon, that way no machine on our network should get badly fragmented. As it is the task takes about 20s to run on a slow machine at a time when the user is not likely to be doing much but the machine will be on. The task scheduler options are very versatile so you can set it up so that it will not effect the user.

On your code; you have done what I think just about everyone new to coding does; Spagetti code. each bit follows on in a long line from the first. This is fine for small tasks, but once you get to the size of your script, it's better to move to using functions for ease of readability if nothing else.

Try breaking the script into sections; one for each program you are running, and have each of those as a function;

Func Run_CCleaner()
Func Run_Wise_Disk_Cleaner()
Exit
Func Run_CCleaner()
     <Code goes Here>
EndFunc
Func Run_Wise_Disk_Cleaner()
     <Other code goes here>
EndFunc
You'll find it much easier to work on.

Also, instead of hard coding your sleeps when waiting for wizard windows, think about what a human does, we don't just wait a few seconds and then click a bit on the screen whether or not what we want is there, we watch the UI for the window we want then click the button we want. I see you already have some of that in there when you first launch the programs, but then fall back on hard coded sleeps. Keep up with the WinWaitActive checks, looking for text in the window is a good way of checking if the main wizard title doesn't change, failing that the button labels can be used too.

All in all you look like you are on the right path though. Keep us posted on how you get on.

Link to comment
Share on other sites

Try breaking the script into sections; one for each program you are running, and have each of those as a function;

Run_CCleaner()
Run_Wise_Disk_Cleaner()
Exit
Func Run_CCleaner()
     <Code goes Here>
EndFunc
Func Run_Wise_Disk_Cleaner()
     <Other code goes here>
EndFunc
You'll find it much easier to work on.

Fixed.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thanks guys for your comments advice

@ engjcowi re gui/tray notification

The first updaters all show there "windows" to enable checking/downloading updates

The maintenance software - the first 3 run in background - with tray icon showing that they are "performing" and take only a short time to complete.

- the last two shows it's window activity (hope you understand my explanation)

I can't see why a gui or tray tip is needed but thanks for the suggestion and comments.

@ Techn0mancer - again thanks for the advice - all appreciated.... I spent the next few hours (many) trying to learn and modify my script like u advised. I checked and checked again everything but cannot see why i'm getting errors.

I dont want to post my erroneous code becoz this is Examples and my original script works.... what to do now?

@ JohnOne - thanks again - yes I picked up straightaway on the mistake but still doesnt help my failed script.

Link to comment
Share on other sites

Got the Func's sorted.. :D

@ Techn0mancer - u mentioned reducing the sleeps - I've tweaked some but stuck on what I think to be a "critical" tweak that could benefit my script but I'm so new to scripting I can't get my head around this,

Basically one app runs in background with command line. It shows a popup but WinWait or WinWaitClose will not identify either the title or text to allow script to continue. The ?.exe just sits there with no way to close within the app after completion.

I've been look at _ProcessListProperties() & _ProcessListCPU but struggling... there must be an easy way to understand these or to script what I need.

example

If ".exe" cpu usage = 0 for 1min then do this

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...