Guest RL Posted June 8, 2004 Share Posted June 8, 2004 (edited) Hi, I am "half-new" to scripting but I found autoit really fun and love it . I made a simple script with Autoit to auto update the Adaware ref file. Have been using it for a while and so far so good. Perhaps some might also find it useful. I am still using Aut3 without GUI support. But a setup interface would be on my to do list when I tried out the autgui version (and will then start to use *.ini files instead of just text file for line reading).Suggestions are welcomed. The complied script (readme file include) can be found here1home.earthlink.net/~ringomei/page2.htmlHere is the script:expandcollapse popup;Unofficial AdawareUpdater ;CHECK INTERNET CONNECTION Tooltip ("Checking Internet Connection with Lavasoft homepage...", 30,0) URLdownloadtofile ("http://www.lavasoftusa.com", @scriptdir & "\testpage.txt") If fileexists (@scriptdir & "\testpage.txt") then filedelete (@scriptdir & "\testpage.txt") Tooltip ("Lavasoft homepage is working", 30,0) Else Tooltip ("First test fail. Checking Internet Connection with Google...", 30,0) URLdownloadtofile ("http://www.google.com/", @scriptdir & "\testpage.txt") If fileexists (@scriptdir & "\testpage.txt") then filedelete (@scriptdir & "\testpage.txt") Tooltip ("Your Internet connection is working", 30,0) Else Tooltip ("Second connection test fail. Checking Internet Connection with Yahoo...", 30,0) URLdownloadtofile ("http://www.yahoo.com/", @scriptdir & "\testpage.txt") If fileexists (@scriptdir & "\testpage.txt") then filedelete (@scriptdir & "\testpage.txt") Tooltip ("Your Internet connection is working", 30,0) else Tooltip ("Fail to connect to the Internet. Your Internet connection does not seem to be working. Update will stop.", 30,0) sleep(5000) exit endif Endif endif ;PROCEED TO CHECK REF FILE VERSION ToolTip("Internet connection is fine. Checking file version that is available.", 30,0) If fileexists (@scriptdir & "\def.txt") then FileMove(@scriptdir & "\def.txt", @scriptdir & "\defold.txt") Filedelete (@scriptdir & "\def.txt") endif sleep (1000) ToolTip("Checking version file...", 30, 0) URLdownloadtofile ("http://www.lavasoftusa.com/update/refs/def", @scriptdir & "\def.txt") sleep (3000) If fileexists (@scriptdir & "\def.txt") then ToolTip("Reading version file...", 30, 0) $file = FileOpen("def.txt", 0) $file1= FileOpen("defold.txt", 0) ;Read in lines $currentdef = FileReadLine($file,4) $previousdef = FileReadLine($file1,4) If $previousdef = $currentdef then fileclose($file) FileClose($file1) filedelete("defold.txt") ToolTip("Your version is current, exiting...", 30, 0) Sleep(5000) Exit Else ToolTip("ID read from the version on your computer: " & $previousdef, 30, 0) Sleep(4000) ToolTip("File ID read from the update version file: " & $currentdef, 30, 0) Sleep(4000) FileWriteline("version.txt", $currentdef & @CRLF) endif FileClose($file) FileClose($file1) Endif ToolTip("Proceed to update in 8 seconds...", 30, 0) sleep (8000) ToolTip("Adaware update is starting...", 30,0) sleep(3000) If FileExists("C:\Program Files\Lavasoft\reflist.zip.old") Then ToolTip("Deleting Old Ref backup file", 30, 0) FileDelete("C:\Program Files\Lavasoft\reflist.zip.old") Endif sleep(1000) ;MOVE BACKUP OLD DOWNLOADED FILES, THEN DO THE DOWNLOAD ToolTip("Backing up Ref list.", 30, 0) FileMove("C:\Program Files\Lavasoft\Ad-aware 6\reflist.ref", "C:\Program Files\Lavasoft\reflist.ref.old") If FileExists(@ScriptDir & "\reflist.zip") Then FileMove(@ScriptDir & "\reflist.zip", "C:\Program Files\Lavasoft\reflist.zip.old") sleep(1000) Endif If FileExists("C:\Program Files\Lavasoft\reflist.ref.old") Then FileDelete(@ScriptDir & "\reflist.ref") Endif If FileExists("C:\Program Files\Lavasoft\reflist.zip.old") Then FileDelete(@ScriptDir & "\reflist.zip") Endif sleep(1000) If FileExists(@ScriptDir & "\reflist.zip") Then Msgbox(0, "Script error", "Update cannot proceed. Please email script writer.") sleep(100) exit Endif If FileExists(@ScriptDir & "\reflist.ref") Then Msgbox(0, "Script error", "File update cannot proceed. Please email script writer.") sleep(100) exit Else $server = filereadline("server.txt",1) ToolTip("Back up of old Ref list success", 30, 0) sleep(3000) ToolTip("Adaware update downloading", 30, 0) ;URLDownloadToFile("http://www.lavasoft.de/update/refs/reflist.zip", @ScriptDir & "\reflist.zip") ;URLDownloadToFile("http://updates.ls-servers.com/reflist.zip", @ScriptDir & "\reflist.zip") URLDownloadToFile($server, @ScriptDir & "\reflist.zip") EndIf ;ERROR CHECKING, UNZIPPING ToolTip("Check if download success", 30, 0) sleep(1000) If FileExists(@ScriptDir & "\reflist.zip") Then ToolTip("File downloaded successfully. Unzipping...", 30, 0) Sleep (3000) Runwait("unzip.exe reflist.zip") sleep(1000) ToolTip("Check if reflist is there.", 30, 0) sleep(1000) If FileExists(@ScriptDir & "\reflist.ref") Then Filecopy(@ScriptDir & "\reflist.ref", "C:\Program Files\Lavasoft\Ad-aware 6\reflist.ref",1) If FileExists("C:\Program Files\Lavasoft\Ad-aware 6\reflist.ref") Then ToolTip("Update Successful. Exit in 4 seconds.", 30, 0) sleep(4000) filedelete("defold.txt") exit Else MsgBox(4096,"Adaware Update Error", "Cannot Unzip. Please unzip the file yourself") filedelete("def.txt") filemove("defold.txt","def.txt") exit EndIf Endif Else $server = filereadline("server.txt",1) ToolTip("Zip file not found. Attempt to download again in 20 seconds.", 20, 0) Sleep (30000) ToolTip("Downloading (second attempt)", 30, 0) ;URLDownloadToFile("http://updates.ls-servers.com/reflist.zip", @ScriptDir & "\reflist.zip") ;URLDownloadToFile("http://www.lavasoft.de/update/refs/reflist.zip", @ScriptDir & "\reflist.zip") URLDownloadToFile($server, @ScriptDir & "\reflist.zip") ToolTip("Check if download success", 30, 0) sleep(1000) If FileExists(@ScriptDir & "\reflist.zip") Then ToolTip("File downloaded successfully. Unzipping...", 30, 0) Sleep (3000) Runwait("unzip.exe reflist.zip") sleep(1000) ToolTip("Check if reflist is there.", 30, 0) sleep(1000) If FileExists(@ScriptDir & "\reflist.ref") Then Filecopy(@ScriptDir & "\reflist.ref", "C:\Program Files\Lavasoft\Ad-aware 6\reflist.ref",1) If FileExists("C:\Program Files\Lavasoft\Ad-aware 6\reflist.ref") Then ToolTip("Update Successful. Exit in 4 seconds.", 30, 0) sleep(4000) filedelete("defold.txt") exit Else MsgBox(4096,"Adaware Update Error", "Cannot Unzip. Please unzip the file yourself") filedelete("def.txt") filemove("defold.txt","def.txt") exit EndIf Endif Else ToolTip("Zip file not found. Please get the file yourself.", 30, 0) filedelete("def.txt") filemove("defold.txt","def.txt") sleep(3000) Endif endif Edited June 8, 2004 by Larry Link to post Share on other sites
bobheart 0 Posted June 8, 2004 Share Posted June 8, 2004 Little error when I ran it . --------------------------- AutoIt Error --------------------------- Line 55 (File "E:\Programs\AutoIt3\Examples\june8\Adaware.au3"): $previousdef = FileReadLine($file1,4) Error: File handle invalid. Make sure that the FileOpen command succeeded. --------------------------- OK --------------------------- Link to post Share on other sites
zcoacoaz 0 Posted June 9, 2004 Share Posted June 9, 2004 for me it cant extract a file when you run it and it says it is updating your program then afterwards it cant download the file that updates it [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to post Share on other sites
R.L. 0 Posted June 9, 2004 Share Posted June 9, 2004 (edited) Little error when I ran it .---------------------------AutoIt Error---------------------------Line 55 (File "E:\Programs\AutoIt3\Examples\june8\Adaware.au3"):$previousdef = FileReadLine($file1,4)Error: File handle invalid. Make sure that the FileOpen command succeeded.---------------------------OK ---------------------------Sorry, the script cannot be run by itself unless you have all the files from the package. You need to get the whole package that come with pre-created files (which also includes a zip utility from Infozip and a readme file). If you do not have the upzip utility, unzip will also fail (I wonder if Autoit will include zip function one day). The new URL download feature is really handy.In addition, I also recommand to put the package at the same directory as the Adaware program, to reduce possible errors from the dos base zip utility included.You can get the whole package here (Please remember to read the readme file in the package). And here is the description page:UnofficialAdawUpdater homepageHere, to get the direct download:UnofficialAdawUpdater060204.zipHope this help!R.L. Edited June 9, 2004 by R.L. R.L.A few pieces made with new GUI enabled AutoIt Link to post Share on other sites
bobheart 0 Posted June 9, 2004 Share Posted June 9, 2004 Those files work fine .. nice job . Link to post Share on other sites
R.L. 0 Posted June 9, 2004 Share Posted June 9, 2004 Those files work fine .. nice job .Thanks. Glad that it works. R.L.A few pieces made with new GUI enabled AutoIt Link to post Share on other sites
emmanuel 0 Posted July 14, 2004 Share Posted July 14, 2004 I just downloaded and ran... It's hanging on the "Exiting..." tooltip. I did have AdAware open from my last scan... I closed adaware, and restarted the autoup dater, it's hanging on Exiting again... "I'm not even supposed to be here today!" -Dante (Hicks) Link to post Share on other sites
R.L. 0 Posted July 14, 2004 Share Posted July 14, 2004 (edited) I just downloaded and ran... It's hanging on the "Exiting..." tooltip. I did have AdAware open from my last scan... I closed adaware, and restarted the autoup dater, it's hanging on Exiting again...Perhaps delete all the Updater files in its directory (and perhaps its folder, too) and "reinstall" again (best to also reboot)? Since Updater creates some files after its first run, it could potiential have left some bad seeds because it was fighting for the ref file with Adaware itself during the last time you open it together with Adaware running.Btw, are you using the auto scan after update optioin? Or you are not using the scan option? If the former, also good to test if the commandline shown in the adaware updater box runs with window "run" command."C:\Program Files\Ad-aware 6\Ad-aware.exe C:\ +S +a +1" Edited July 14, 2004 by R.L. R.L.A few pieces made with new GUI enabled AutoIt Link to post Share on other sites
emmanuel 0 Posted July 14, 2004 Share Posted July 14, 2004 I am running the scan option, I've "reinstalled" the UAU, it got to updated successful, and is now sitting at Exiting... One thing, I'm not running it from within the AdAware folder... "I'm not even supposed to be here today!" -Dante (Hicks) Link to post Share on other sites
R.L. 0 Posted July 16, 2004 Share Posted July 16, 2004 (edited) I've updated the script and the file. I *think* the problem should disappear. If not, please let me know Homepage/download page:Unofficial Adaware Updater Home Page Direct Download:For existing user:hereFor new user:hereScript (reference only, don't run it by itself):http://www.autoitscript.com/fileman/users/public/RL/unofficial%20adaware%20updater.au3 Edited July 16, 2004 by R.L. R.L.A few pieces made with new GUI enabled AutoIt Link to post Share on other sites
emmanuel 0 Posted July 16, 2004 Share Posted July 16, 2004 --------------------------- AutoIt Error --------------------------- Line 0: Run($COMMANDLINE) Error: Unable to execute the external program. The system cannot find the file specified. --------------------------- OK ---------------------------My first guess is that you should put double quotes around the app path, ie $commandline = '"C:\Program Files\Lavasoft\Ad-aware 6\Ad-aware.exe" C:\ +S +a +1' you could do this in your GUI by having a seperate line for app path and command line switches, or get the path from ad-aware.exe from somewhere in the registry... Or use FileGetShortName for the app path... Oh, my just adding the quotes around the app path in your dialog did fix the error (first time I forgot the "change" button.) Those should be there by default. one other thing, even if my version is current, I'd like it to run the scan from the one click. "I'm not even supposed to be here today!" -Dante (Hicks) Link to post Share on other sites
R.L. 0 Posted July 16, 2004 Share Posted July 16, 2004 Oh, my just adding the quotes around the app path in your dialog did fix the error (first time I forgot the "change" button.) Those should be there by default.one other thing, even if my version is current, I'd like it to run the scan from the one click.You know what, that quote thing is the strangest part that I never figured it out. My experiences are that AutoIt behave somewhat inconsistantly on this under XP. In some systems, if I use quotes, it would work, in some, it doesn't and the quotes I added was not read correctly. For example, I wrote a google search bar, when run the script the first few times, using double quotes to search would work for phrase search. Then, suddenly, eveything being equal, the double quotes stop working, I need to use single quote. Then after a while, single quote no longer works. I think it is something about XP. For example, if you open an folder window in XP, press crl-F, the search menu pop up, it always take a while for XP to enter the search location with the quotes (XP will add the quotes itself, sometimes it is successful, sometimes it is not).As for now, I am not dare to change the script on that, I'am afraid that I will mess up and it won't work on some systems (so far I have very few report on it not working). Hence, I think I shall put a line in the read me file, to tell the users to try to put the quotes in it only if it doesn't work correctly in their system. If I add the quotes into the code, some win XPs could add additional quotes to it and break it (it happened once in a while when I was testing some other scripts). R.L.A few pieces made with new GUI enabled AutoIt Link to post Share on other sites
bobheart 0 Posted August 24, 2004 Share Posted August 24, 2004 When will you have an update on this . I see the link on your site for the download is bad . Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now