PDA

View Full Version : AutoIT autoapp crap


focuz
01-25-2008, 05:42 AM
So I keep seeing these posts about autoit, so I decided to give it a try. I got a little bit of a small script going so I figured I would post it and try and get other members to contribute to it as well so hopefully we can get something that all techs can use. The scripts below, I'm not a programmer in any way so don't mock the primitive coding. And yes I know its basically just a nice batch program with app switches but its the easiest way I could think about doing things.

And again I don't want to be the only participate. So if anyones has more programs they can add please post the code addon so that we can get this growing.

EDIT 01-25-08: Changed system restore/disable code

EDIT 01-27-08: Added in functionality for defrag and running the XP clean manager. To run the clean manager you will need the attached .reg file which imports the sageset:99 settings and also added a GUI.

EDIT 02-02-08: Finished the GUI and added in an automatic install section.

Theirs one spot on swshredder where enter wont select the button and theirs no alt keyboard option, so I get stuck using a mouseclick cordinate, let me know if you guys can think of a better approach.


#comments-start

*First Aid's Auto Script - 01.26.2008
Autor: Justin Brower (focuz)
E-mail: focuz07@gmail.com
Language: English
OSystem: Windows Xp

Features:

- Run CCleaner, Adware, Spyware and Virus detection
- Defrag Boot-up Files, Main hard-drive and Secondary hard-drive
- Import XP clean manager settings then automatically runs.

Requirements: Legal copy of Microsoft Windows Xp

Enjoy...

#comments-end


; GUI
#include <GUIConstants.au3>
$mainwindow = GUICreate ("First Aid Auto App", 370, 200)
$ParentWin_Pos = WinGetPos($mainwindow, "")
; Menu
$filemenu = GuiCtrlCreateMenu ("File")
$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)
$recentfilesmenu = GuiCtrlCreateMenu ("Recent Files",$filemenu)
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GuiCtrlCreateMenu ("?")
$aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu)
; Buttons
$virus = GuiCtrlCreateButton("Virus Defense", 10, 30, 100, 30)
$opti = GuiCtrlCreateButton("Optimization", 130, 30, 100, 30)
$install = GuiCtrlCreateButton("Installs", 250, 30, 100, 30)


GuiSetState()


While 1
$msg = GUIGetMsg()

Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $aboutitem
Msgbox(0,"About","*First Aid's Auto Script" & @LF & "Created on 01.26.2008" & @LF & " " & @LF & "Autor: Justin Brower (focuz)" & @LF & "E-mail: focuz07@gmail.com" & @LF & " " & @LF & "Enjoy...")
Case $msg = $exititem
ExitLoop

Case $msg = $virus



############################
#### Virus Defense #########
############################


;disables system restore
Run("PortableApps\Virus Defense\SystemrestoreDisable\SystemRestore.exe")
WinWaitActive("Enable/Disable System Restore")
Send("{TAB}")
Send("{ENTER}")
WinWaitActive("Done")
Send("{ENTER}")
WinWaitActive("Enable/Disable System Restore")
ProcessClose("SystemRestore.exe")

; automatically runs CCleaner and removes tempfiles, it DOES NOT run the registry scans.
RunWait("PortableApps\Virus Defense\ccleaner\portable.exe /AUTO" )

; automatically runs spybot
RunWait("PortableApps\Virus Defense\Spybot - Search & Destroy\SpybotSD.exe /autoupdate /onlyspyware /autocheck /autofix /autoclose")

; automatically runs ad-aware
RunWait("PortableApps\Virus Defense\adaware\AdAware\Ad-Aware.exe +update +procnuke +cskip /smart")

; automatically runs ClamWim
RunWait("PortableApps\Virus Defense\ClamWin\App\clamwin\bin\ClamWin.exe --mode=scanner --path=c: --remove --close" )



; Finishes the script off with a nice hijackthis log
; If you want it to automatically run and just create a log add in the switch /autolog
RunWait("PortableApps\Virus Defense\hijackthis\HiJackThis.exe" )
WinWaitActive("Enable/Disable System Restore")
Send("{TAB}")
Send("{ENTER}")


Case $msg = $opti

############################
#### Optimization #########
############################

If @HomeDrive = "C:" Then
Dim $Drive1 = "C:\"
Dim $Drive2 = "D:\"
Else
Dim $Drive1 = @HomeDrive & "\"
Dim $Drive2 = "C:\"
EndIf

; Imports custom registry tweaks
$regFile0 = "PortableApps\XP Fixes\Registry Tweaks\tweaks.reg"
RunWait("Regedit /s" & $regFile0)

; automatically runs CCleaner and removes tempfiles, it DOES NOT run the registry scans.
RunWait("PortableApps\Virus Defense\ccleaner\portable.exe /AUTO" )

; Runs Defrag
RunWait("" & $Drive1 & "\WINDOWS\system32\defrag.exe " & $Drive1 & " -f")
RunWait("" & $Drive1 & "\WINDOWS\system32\defrag.exe " & $Drive2 & " -f")

; Runs Clean Manager
$regFile1 = "WINDOWS\sageset99.reg"
RunWait("Regedit /s" & $regFile1)
RunWait("" & $Drive1 & "\WINDOWS\system32\Cleanmgr.exe /Sagerun:99")





Case $msg = $install
$ChildWin = GUICreate("Child GUI", 200, 300, $ParentWin_Pos[0] + 100, $ParentWin_Pos[1] + 100, -1, -1, $mainwindow)
$spybot = GuiCtrlCreateCheckbox("Spybot", 30, 30, 80, 20)
$adaware = GuiCtrlCreateCheckbox("Adaware", 30, 60, 80, 20)
$avg = GuiCtrlCreateCheckbox("AVG", 30, 90, 80, 20)
$7zip = GuiCtrlCreateCheckbox("7 Zip", 30, 120, 80, 20)
$gobutton = GuiCtrlCreateButton("Go!", 50, 200, 100, 30)
GUISetState(@SW_SHOW)
GUISwitch($mainwindow)

While 1
$msg = GUIGetMsg(1)
Select
Case $msg[0] = $GUI_EVENT_CLOSE
;Check if user clicked on the close button of the child window
If $msg[1] = $ChildWin Then

GUISwitch($ChildWin)
GUIDelete()
ElseIf $msg[1] = $mainwindow Then

GUISwitch($mainwindow)
GUIDelete()
Exit
EndIf
case $msg[0] = $gobutton
If BitAnd(GUICtrlRead($spybot), $GUI_CHECKED) Then
RunWait("needed installs\spybot 1.5.exe /silent /norestart")
EndIf

If BitAnd(GUICtrlRead($adaware), $GUI_CHECKED) Then
RunWait("needed installs\aawsepersonal.exe /quiet")
EndIf

If BitAnd(GUICtrlRead($avg), $GUI_CHECKED) Then
RunWait("needed installs\AVG Free 7.5.exe /DONT_START_APPS /NO_AVGW_STARTUP /QUIT_IF_INSTALLED")
EndIf

If BitAnd(GUICtrlRead($7zip), $GUI_CHECKED) Then
RunWait("needed installs\7z457.exe /S ")
EndIf

msgbox(1, "Done", "Installations Complete")
GUISwitch($ChildWin)
GUIDelete()
EndSelect

WEnd


EndSelect
WEnd

GUIDelete()

Exit

gunslinger
01-25-2008, 12:58 PM
Now we are getting somewhere. Thank you for this. As I play around with Autoit more I'll try to contribute some to this thread.

tartis
01-25-2008, 01:59 PM
This looks great, if I only knew how to use it. I have downloaded AutoIT and installed it on my laptop. Do I create scripts, then run them from the Windows GUI?

gunslinger
01-25-2008, 03:07 PM
You should be able to open AutoIT, create new script,and just paste this script into it. You will have to change the path depending on your needs. Then save the script or export it as an .exe file. I think this is right, someone correct me if I'm wrong.

greggh
01-25-2008, 06:12 PM
So I keep seeing these posts about autoit, so I decided to give it a try. I got a little bit of a small script going so I figured I would post it and try and get other members to contribute to it as well so hopefully we can get something that all techs can use. The scripts below, I'm not a programmer in any way so don't mock the primitive coding. And yes I know its basically just a nice batch program with app switches but its the easiest way I could think about doing things.

And again I don't want to be the only participate. So if anyones has more programs they can add please post the code addon so that we can get this growing.



A couple things. First you really shouldnt be using sleep to wait for a change in the applications state (the sleep 700 calls.) There are multiple ways to watch for a window changing besides just winwaitactive. To do that in the easiest way you would use winwaitactive with both the first and second parameters. Like:
WinWaitActive("Enable/Disable System Restore","SOMETHING ELSE THAT APPEARS INSIDE THE WINDOW")
Send("{TAB}")
Send("{ENTER}")
WinWaitActive("Enable/Disable System Restore","SOMETHING NEW/CHANGED THAT APPEARS INSIDE THE WINDOW")
Send("{ENTER}")
WinWaitActive("Enable/Disable System Restore","SOMETHING NEW/CHANGED THAT APPEARS INSIDE THE WINDOW")
ProcessClose("SystemRestore.exe")


Depending on the speed of the computer and how slow it is running Sleep can be really unreliable.

tartis
01-25-2008, 07:45 PM
What are you using to disable System Restore?

focuz
01-25-2008, 11:33 PM
The program I use for the restore is small enough, I attached it for you.

Thanks greggh for the replies, I will have to play some more over the weekend. I just started using autoit this week.

focuz
01-26-2008, 04:50 AM
Well I just added in code to run cwshredder as well, and that about does it for all the programs I use for virus/spyware defense. I was thinking of using Stinger but I noticed it wasn't updated since Feb 2006 so I didn't feel it was strong enough to use for computer cleanups. If you guys have others you want to add let me know.

I think I might start on an optimizing section now for defrag and registry tweak stuff. Then go from their, maybe add in some automatic installs for people without avg and add in a gui. I don't know... Post opinions so I know if this would be useful or if I'm just wasting time.

gunslinger
01-26-2008, 06:23 AM
Looks like exactly what I'm trying to do. Very helpful. As far as the GUI I like to use auto play media studio.

greggh
01-26-2008, 08:25 AM
Looks like exactly what I'm trying to do. Very helpful. As far as the GUI I like to use auto play media studio.

You can create full guis in autoit.

gunslinger
01-26-2008, 04:26 PM
I'm sure you can , but not being a programmer I find the drag and drop interface easier to use.

focuz
01-27-2008, 07:16 PM
Alright guys I added in defrag and clean manager. I think its about time to add in a gui. Will see what I can come up with later in the week.

focuz
02-02-2008, 07:00 AM
GUI and install section posted. I will try and find somewhere to upload the .exe and my files so that you guys can easily test without having to change file paths and download some extra files I used like a custom sageset reg file.

greggh
02-02-2008, 06:15 PM
Great progress. Have you thought about using a better/faster defrag too?

http://majorgeeks.com/Auslogics_Disk_Defrag_d5266.html

Runs pretty fast (if you do it AFTER ccleaner of course, so it doesnt fix all the temp files that you'll be removing anyways.) I see better results with this tool as well.

focuz
02-03-2008, 07:50 PM
Well this would be going on my flash drive so I was trying to keep space saved and I also need to make sure all the programs are portable. It looks like you have to install that defrag utility to run it.

TechPro
02-04-2008, 07:39 PM
Thats looking really good focuz....I would love to help out but have enough learning to do at the moment. Im studying for my Microsoft Exchange MCP.
Keep us posted!

pattertj
02-14-2008, 07:16 PM
Well I happen to be writing the same script for my University's Computer Help Desk at UW-Eau Claire. I have encountered the same issue with CWShredder as well. I too am stumped, but I'll see what I can find out. I run most of the same apps, but I have to install them first so my script is a bit different as it will install, run, update, then scan a computer. The programs we use are...

CCleaner
CWShredder
AIMFix
VundoFix
Spybot 1.5
Ad-Aware 2007
Symantec Anti-Virus

As well as an online scan; Windows' Safety.live.com scan.

I've never heard of Auto Play Media Studio, I was trying to write the GUI in AutoIT and it was a bit slow going, I'll have to give APMS a try though. I've got some VB.net experience, but no scripting, although it is coming along easily enough.

Great thread, I look forward to developments and helping out.

tartis
02-19-2008, 07:21 PM
The program I use for the restore is small enough, I attached it for you.

Thanks greggh for the replies, I will have to play some more over the weekend. I just started using autoit this week.

I did not see the attachment for System Restore.

frostbyte
03-16-2008, 04:54 AM
Hello Guys,

I have been interested in having a tool just like this for a long time. I have spent a lot of time looking into several different all in one tools. I would have to say you guys are on the right track to developing an excellent time saving tool. I just wish I was better at scripting so that I could contribute.

A few years ago I ran across a Geek Squad CD. I don't give these guys credit for very much , but the guys that developed this cd did a pretty good job. I think it can be used as a very good blueprint for this project. It has a GUI that allows you to choose which apps you want to run and it also allows a complete online update of all the apps.

Like everyone else I have my list of apps that I like to use to cleanup a system. The primary ones are AVG, Spybot, Hijack This, CCleaner, ect. I would like to see this project grow so that it includes most of the popular apps. I personally think it would be better without AutoIT but that's just my opinion (please don't take it personally). I think VB and BAT scripts would work best.

My goal would be to have a flash drive loaded with portable apps and controlled with a custom GUI allowing you to download the latest updates for all apps with one click. Then select the apps you want to run. Have an option to create a restore point, disable system restore, backup the registry, ect.

These are just some ideas. Please let me know what you guys think.

I can't wait to see how your project turns out. I love Technibble. I've been looking for a place to share ideas.

Brian Padgett
diversifiedcomputersolutions

Sander
03-26-2008, 02:16 AM
I have encountered the same issue with CWShredder as well.


Hello Guys,

Just registered here to join this discussion. Why? First of all to join the endless fight against spyware. Second because I'm programming for some months a program/project like this too (which I'm not gonna mention, because I'm surely will get kicked for spamming, I guess ;-))

Now that's told, what kind of problems do you have with CWShredder? Problems with AutoIt It (:rolleyes:)? Since I did not have any problems with it so far, I guess I can help you out with this one ;-)

Thats it for now, back to programming.

KR,
Sander

lazzo71
05-05-2008, 06:45 AM
Hey guys,
I have been playing with the scripts above and have run into a bit of trouble. I used the clamwin example in the new article but it doesn't seem to work, I was hoping that it did so I could use it for mine. I need to be able to autostart ccleaner. I have set it up so it installs but can't get it to autostart.
Can anyone help with the script!!!!
(I know it's very basic but I've only been using this for a day or so.)

focuz
05-06-2008, 01:38 AM
Hey lazzo, we would really need to see your code in order to help you out. Make sure your file paths are exact and double check your work.

Sander
05-15-2008, 11:40 PM
Thats for sure, if you post your code so far we can get it debugged in no time :cool: