xircon Posted June 20, 2008 Share Posted June 20, 2008 Hi,I would like to keep a watch on:http://ftp.kaspersky.com/devbuilds/RescueD...ue_2008.001.isoits a bootable AV CD. I would like to keep the most current version on my flash drive and download when it is updated.I know how to download with:InetGet("http://ftp.kaspersky.com/devbuilds/RescueDisk/kav_rescue_2008.001.iso","kav.iso")But how do I watch the page for change in name etc etc.First attempt at doing anything internet based, so some pointers would be good.CheersSteve Link to comment Share on other sites More sharing options...
ProgAndy Posted June 20, 2008 Share Posted June 20, 2008 You could compare InetGetSize Or, because on the server filelistung is activated: #include <Inet.au3> #include <Array.au3> $text = _INetGetSource("http://ftp.kaspersky.com/devbuilds/RescueDisk/") $text = StringRegExpReplace($text,'.*<a href="../">.*',"") $fileregexp = StringRegExp($text,'\n(.*:\d\d).*?(\d+).*?<a href="(.*?)"',4) Dim $fileinfo[UBound($fileregexp)][4] For $i = 0 To UBound($fileregexp)-1 $key = $fileregexp[$i] For $j = 0 To UBound($key)-1 $fileinfo[$i][$j] = $key[$j] Next Next ; FileInfo: 1 -> Date ; 2 -> Size in bytes ; 3 -> Name _ArrayDisplay($fileinfo,"Row | Match | Date | Size | Name") *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
herewasplato Posted June 20, 2008 Share Posted June 20, 2008 Here is another way.expandcollapse popup#include <INet.au3> ;if the file is not there - make it If Not FileExists("reference.txt") Then $file = FileOpen("reference.txt", 9) FileClose($file) EndIf ;open file in read mode $file = FileOpen("reference.txt", 0) ;Check if file opened for reading OK If $file = -1 Then MsgBox(0, "FileOpen Error", "Unable to open file.") Exit EndIf ;read file contents $fileName2Reference = FileRead($file) ;Check if file was read OK If @error = 1 Then MsgBox(0, "FileRead Error", "Unable to read file.") Exit EndIf FileClose($file) ;get new info $s_URL = "http://ftp.kaspersky.com/devbuilds/RescueDisk/" $var = _INetGetSource($s_URL) $varArray = StringSplit($var, @CRLF, 1) ;work thru each line of page source For $i = 1 To $varArray[0] If StringInStr($varArray[$i], "kav_rescue_") <> 0 Then $fileName2Get = StringMid($varArray[$i], StringInStr($varArray[$i], "kav_rescue_"), 23) If $fileName2Reference <> $fileName2Get Then $fileName2Get = StringMid($varArray[$i], StringInStr($varArray[$i], "kav_rescue_"), 23) InetGet("http://ftp.kaspersky.com/devbuilds/RescueDisk/" & $fileName2Get, $fileName2Get) ;open file in write mode $file = FileOpen("reference.txt", 2) ;Check if file opened for reading OK If $file = -1 Then MsgBox(0, "FileOpen Error", "Unable to open file.") Exit EndIf FileWrite($file, $fileName2Get) FileClose($file) EndIf EndIf NextYou might want to add a progress bar. You could search the flash drive for the latest version of the file of interest and then download a new one if needed - but I took the easy way out and wrote to a reference file... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
xircon Posted June 25, 2008 Author Share Posted June 25, 2008 Thanks Guys, Works like a dream. Steve Link to comment Share on other sites More sharing options...
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