Search Knowledgebase:![]() |
Use an external program to modify a monitored document
User question:
> I have a few sites that I want to modify before they are processed
> with WebSite-Watcher. Is there any way to pass these pages to an
> external program, modify the source and put it back to WebSite-
> Watcher for final processing?
This can be done with a private plugin and the event function "Wsw_PreProcessPage".
In the event function "Wsw_PreProcessPage" you have to execute the following steps:
1. | Save the source of the checked page to a temporary file |
2. | Modify this temporary file with your programm (command line tool) |
3. | Load the modified file |
4. | Delete the temporary file |
You can use this code as starting point. It will execute the program "c:\tools\htmlconv.exe" with the parameter /filename="tempfile" (the external tool should then overwrite the temporary file with the modified content).
Sub Wsw_PreProcessPage(Handle, ByRef sMemWeb, ByRef sStatusMessage As String, ByRef iStatusCode As Integer)
Dim sTempFile = "c:\tools\" + GetUniqueID + ".htm"
StringToFile(sTempFile, sMemWeb)
ExecuteAndWait("c:\tools\htmlconv.exe", "/filename=""" + sTempFile + """", True)
FileToString(sTempFile, sMemWeb)
DeleteFile(sTempFile)
End Sub