Search Knowledgebase:![]() |
Automatically download all EXE files or a page
User question:
> I'm monitoring a download page and want to automatically download
> all EXE files when the page has been changed. Can this be done with
> WSW?
You can do this with a private plugin. If WebSite-Watcher then detects an update, all EXE files will be downloaded with the Download Manager.
Sub Wsw_ActionsOnUpdate(Handle, iUpdateStatus, ByRef sStatusMessage, ByRef iStatusCode)
' iUpdateStatus ... 1 = initialized, 2 = updated, 3 = error
' iStatusCode ... 0 = no error (default), 1 = error
If iUpdateStatus = 2 Then
' Bookmark was updated
Dim i, sUrl, sCheckUrl, sMem
'Load new version of the page
sMem = Bookmark_LoadCacheFile(Handle, 2)
'Extract all link URLs
sCheckUrl = Bookmark_GetProperty(Handle, "check_url")
Dim sUrlList = HtmlExtract(sMem, sCheckUrl, 0)
'Loop through bookmark list and download exe files
For i = 0 To StringList_ItemCount(sUrlList) - 1
sUrl = StringList_GetItem(sUrlList, i)
If LowerCase(Right(sUrl, 4)) = ".exe" Then
DownloadFile(Handle, sUrl, "", False)
End If
Next
End If
End Sub