Ich habe ein gutes UpdatesScript gefunden, was bei FileHippo nach dem passendem Update schaut. Nur leider ist mir das Angebot etwas mager... deshalb wollte ich fragen, was man am Script umstellen muss , damit das Script sich auf softpedia.com umschaut + updatet?
#include-once
#include <array.au3>
Func _FileHippoDownload($sProgramTitle, $sDownloadFolder, $sDownloadFileName = "", $bDownload = True, $bSkipBeta = True, $FunctionToCall = "")
Local $DownloadUrl, $asDownloadUrl
Local $sCurrentVersion, $asCurrentVersion
Local $sBaseSite = 'http://filehippo.com'
Local $sBaseFolder = '/download_' & $sProgramTitle & '/'
Local $sVersionFolder = "" ; for Beta rejection
;String trailing slash "\"
If StringRight($sDownloadFolder, 1) = "\" Then StringLeft($sDownloadFolder, StringLen($sDownloadFolder) - 1)
If DirCreate($sDownloadFolder) = 0 Then Return SetError(6, 0, "") ; destination unreachable
;Get source for program page
Local $sPageSource = _GetSourceCode($sBaseSite & $sBaseFolder)
If @error Then
;Failed to get programs page
Return SetError(1, 0, "")
EndIf
;Latest Version<br/><b>Malwarebytes Anti-Malware 1.51.1</b><br/><br/>Old Versions
$asCurrentVersion = StringRegExp($sPageSource, '(?s)(?i)Latest Version<br(.*?)</b><br/><br/>Old Versions', 3)
If @error Then
Return SetError(2, 0, "")
EndIf
$sCurrentVersion = StringMid($asCurrentVersion[0], StringInStr($asCurrentVersion[0], " ", 0, -1) + 1)
;Check for BETA copy rejection
If $bSkipBeta And StringInStr($asCurrentVersion[0], "beta") <> 0 Then
;Get table of old versions
$asCurrentVersion = StringRegExp($sPageSource, '(?s)(?i)>Old Versions<(.*?)download_opera/history/', 3)
If @error Then
Return SetError(2, 0, "")
EndIf
; Break table into array
$asCurrentVersion = StringRegExp($asCurrentVersion[0], '(?s)(?i)<a href="/download_opera/(.*?)/">(.*?)</a>', 3)
If @error Then
Return SetError(2, 0, "")
EndIf
;search array for NON beta version
For $iItem = 1 To UBound($asCurrentVersion) - 1 Step 2
If StringInStr($asCurrentVersion[$iItem], "beta") = 0 Then
$sVersionFolder = $asCurrentVersion[$iItem - 1] & "/"
$sCurrentVersion = StringMid($asCurrentVersion[$iItem], StringInStr($asCurrentVersion[$iItem], " ", 0, -1) + 1)
ExitLoop
EndIf
Next
If $sVersionFolder = "" Then
;NO NON BETA version available
Return SetError(9, 0, "")
Else
;Found non beta
;Get source for non beta program page
Local $sPageSource = _GetSourceCode($sBaseSite & $sBaseFolder & $sVersionFolder)
If @error Then
;Failed to get programs page
Return SetError(1, 0, "")
EndIf
EndIf
EndIf
;Get download URL
$asDownloadUrl = StringRegExp($sPageSource, '(?s)(?i)<a href="' & $sBaseFolder & 'download/(.*?)/">', 3)
If @error Then
Return SetError(2, 0, "")
EndIf
$_DownloadUrl1 = $asDownloadUrl[0]
;Get source for details page
Local $sPageSource = _GetSourceCode($sBaseSite & $sBaseFolder & 'tech/')
If @error Then
;Failed to get programs page
Return SetError(1, 0, "")
EndIf
;Get Details/description Table
;$asDescTable = StringRegExp($sPageSource, '(?s)(?i)<div class="desc">.*?<table>(.*?)</table>', 3)
$asDescTable = StringRegExp($sPageSource, '(?s)(?i)<div id="txt">.*?<table>(.*?)</table>', 3)
If @error Then
Return SetError(2, 0, "")
EndIf
$sDescTable = $asDescTable[0]
;Split up table
$asDescTable = StringRegExp($sDescTable, '(?s)(?i)<tr><td><b>(.*?):</b></td><td>(.*?)</td></tr>', 3)
If @error Then
Return SetError(2, 0, "")
EndIf
;Convert to 2D array
Dim $_FileDetails[UBound($asDescTable) / 2 + 2][2]
$_FileDetails[0][0] = UBound($asDescTable) / 2 ; number of rows in array
$_FileDetails[2][0] = $asDescTable[0]
$_FileDetails[2][1] = $asDescTable[1]
For $item = 2 To UBound($asDescTable) - 1 Step 2
$_FileDetails[$item / 2 + 2][0] = $asDescTable[$item]
$_FileDetails[$item / 2 + 2][1] = $asDescTable[$item + 1]
Next
;Cleanup Author
Local $iIndex = _ArraySearch($_FileDetails, "Author")
If Not @error Then
$_FileDetails[$iIndex][1] = StringLeft($_FileDetails[$iIndex][1], StringInStr($_FileDetails[$iIndex][1], "<") - 1)
EndIf
;Cleanup HomePage
$iIndex = _ArraySearch($_FileDetails, "HomePage")
If Not @error Then
$_FileDetails[$iIndex][1] = StringMid($_FileDetails[$iIndex][1], StringInStr($_FileDetails[$iIndex][1], "href=") + 6)
$_FileDetails[$iIndex][1] = StringMid($_FileDetails[$iIndex][1], 1, StringInStr($_FileDetails[$iIndex][1], '"') - 1)
EndIf
$_FileDetails[1][0] = "Latest Version"
$_FileDetails[1][1] = $sCurrentVersion
If $bDownload Then
;<a href="/download_opera/download/f9c81a8e689661f472f47aa7a0b12ada/"><img src="http://cache.filehippo.com/img/down5.png" alt="Download"/></a>
;Get source for download page
$sPageSource = _GetSourceCode($sBaseSite & $sBaseFolder & 'download/' & $_DownloadUrl1) ; downlaod page
If @error Then
;Failed to get programs page
Return SetError(3, 0, "")
EndIf
;<a id="_ctl0_contentMain_lnkURL" class="black" href="/download/file/de709ff1117ec419609d7fceecd86e625fe523b1385fa00515aa824249206a40/">If not then please click this link</a>
$asDownloadUrl = StringRegExp($sPageSource, '(?s)(?i)href="/download/file/(.*?)/">', 3)
If @error Then
Return SetError(4, 0, "")
EndIf
$DownloadUrl = "/download/file/" & $asDownloadUrl[0] & "/"
If $sDownloadFileName = "" Then
;Use FileHippo filename
$sDownloadFileName = $_FileDetails[_ArraySearch($_FileDetails, "Filename")][1]
EndIf
; DOWNLOAD FILE
Local $iFileSize = InetGetSize($sBaseSite & $DownloadUrl, 1)
Local $DownloadedSoFar = 0 ; howmany bytes of the file have been downloaded
Local $bRtn = True ; Progress function return OK
Local $hDownload = InetGet($sBaseSite & $DownloadUrl, $sDownloadFolder & "\" & $sDownloadFileName, 1, 1)
Do
If $FunctionToCall <> "" Then
$bRtn = Call($FunctionToCall, Floor((InetGetInfo($hDownload, 0) / $iFileSize) * 100))
If @error Then
InetClose($hDownload) ; Close the handle to release resourcs.
Return SetError(8, 0, "")
EndIf
EndIf
Sleep(250)
Until InetGetInfo($hDownload, 2) Or $bRtn = False ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; Close the handle to release resourcs.
If @error Then
Return SetError(5, 0, "")
EndIf
If $bRtn = False Then
;Download aborted by $FunctionToCall
Return SetError(7, 0, "")
EndIf
EndIf
Return $_FileDetails
EndFunc ;==>_FileHippoDownload
Func _GetSourceCode($_Url)
Local $_InetRead = InetRead($_Url)
If Not @error Then
Local $_BinaryToString = BinaryToString($_InetRead)
If Not @error Then Return $_BinaryToString
EndIf
EndFunc ;==>_GetSourceCode
ProgressOn("FileHippo Download", "Downloading : opera")
$test = _FileHippoDownload("opera", @ScriptDir & "\", "install_opera.exe", True, True, "_UpdateProgress")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
ProgressOff()
Run("$test")
Exit
#include <Misc.au3>
Func _UpdateProgress($Percentage)
ProgressSet($Percentage, $Percentage & "%")
If _IsPressed("77") Then Return False ; Abort on F8
Return True ; bei 1 Fortsetzten
EndFunc ;==>_UpdateProgress