www.website-watcher.com Forum Index www.website-watcher.com
HomeProductsNewsContact
 
 FAQFAQ   SearchSearch   RegisterRegister   ProfileProfile   Log inLog in 

Plugin request : Also save the pdf file on my hard drive

 
Post new topic   Reply to topic    www.website-watcher.com Forum Index -> Plugins and Scripts
View previous topic :: View next topic  
Author Message
ifen



Joined: 13 Aug 2009
Posts: 12

PostPosted: Thu Aug 13, 2009 4:09 pm    Post subject: Plugin request : Also save the pdf file on my hard drive Reply with quote

Plugin request: Also save the pdf (or xls...) file on my hard drive when change is detected

Hello,

I would be very thankful if there is a "Basic" programmer overhere who can helps me program that ! Wink

Martin advised me to write a private plugin myself so Website-Watcher could check if a pdf file has changed and then save it into my hard drive by adding a predefined name.

Example:

url = http://www.sedl.org/scimath/pasopartners/pdfs/health.pdf
Website-Watcher can monitor changes by screenshot (and sending the result by email) but also at the same time save the pdf file in a folder :
For instance:
C:\wsw\2009_08_13_health.pdf

In this case the pdf file could be renamed by adding at the beginning of its name the current date and hour.


Martin advised me :
Quote:
If you monitor PDF files you could do that by writing your own Plugin.

Within the Plugin, you can use the function

sub Bookmark_SaveWebDocBinary(Handle, sFilename As String)

to save the PDF file to any filename you want.


Alas, even after reading about it, I don't understand much of the "basic" language, so any help would be welcomed. Wink

Thanks in advance,
ifen
Back to top
View user's profile Send private message
ifen



Joined: 13 Aug 2009
Posts: 12

PostPosted: Fri Oct 09, 2009 2:33 pm    Post subject: Reply with quote

Hello,
Does anyone have any idea on how to do this ?
Thanks in advance Wink
Back to top
View user's profile Send private message
Martin Aignesberger
Site Admin
Site Admin


Joined: 11 May 2005
Posts: 4884

PostPosted: Thu Oct 15, 2009 4:13 pm    Post subject: Reply with quote

Just to let you know that we have plans to simplify it in WebSite-Watcher 5.2.0. Then there will be no need to change the original PDF plugin.
_________________
Martin Aignesberger [SUPPORT]
Back to top
View user's profile Send private message
ifen



Joined: 13 Aug 2009
Posts: 12

PostPosted: Thu Oct 15, 2009 4:30 pm    Post subject: Reply with quote

Hello,

If this means there will be a file downloader inside Website-Watcher for each bookmark (saving the file(s) on a specified path in the hard drive), I would be very pleased indeed. Wink

Do you have any rough idea when version 5.2.0. will be ready ? Wink

Thanks in advance Wink
Back to top
View user's profile Send private message
Martin Aignesberger
Site Admin
Site Admin


Joined: 11 May 2005
Posts: 4884

PostPosted: Fri Oct 16, 2009 8:05 am    Post subject: Reply with quote

Quote:
If this means there will be a file downloader inside Website-Watcher for each bookmark


No, this is not what it means, you will still need the Plugin system. But you can solve your problem with 3 lines of code, independently from assigned Plugins.

Quote:
Do you have any rough idea when version 5.2.0. will be ready ?


No ETA yet, sorry.
_________________
Martin Aignesberger [SUPPORT]
Back to top
View user's profile Send private message
ifen



Joined: 13 Aug 2009
Posts: 12

PostPosted: Fri Oct 16, 2009 8:29 am    Post subject: Reply with quote

Hello Martin, Thank you for answering. Keep up the good work. Wink
Back to top
View user's profile Send private message
watchdog



Joined: 16 Jul 2009
Posts: 13

PostPosted: Thu Feb 04, 2010 8:28 am    Post subject: Reply with quote

Martin,

can you give un update.
How can this be done now with the new version?
Back to top
View user's profile Send private message
Martin Aignesberger
Site Admin
Site Admin


Joined: 11 May 2005
Posts: 4884

PostPosted: Thu Feb 04, 2010 10:38 am    Post subject: Reply with quote

To save the original PDF file when an update was detected, you can use the following Private Plugin:

Code:
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_SaveWebDocBinary(Handle, "c:\folder\filename.pdf")
   End If
End Sub


Starting with version 2010, Private Plugins can coexist with Shared Plugins and used to save the original file. In that code you have to change the target location and filename.
_________________
Martin Aignesberger [SUPPORT]
Back to top
View user's profile Send private message
ifen



Joined: 13 Aug 2009
Posts: 12

PostPosted: Thu Apr 01, 2010 1:51 pm    Post subject: Reply with quote

Hello Martin,

Thanks.
I have tried to peruse in the script help file (http://www.aignes.com/wswhelp/index.htm?help_plugins_eventfunctions.htm) about how to add automatically the current checking date+time of the pdf file name (see example in my first message for this thread).

I guess I have to use these :
ExtractFileName
MonthName
WeekdayName
Year

But I have no clue about how to insert them in your code.

Thanks in advance Wink
Back to top
View user's profile Send private message
Martin Aignesberger
Site Admin
Site Admin


Joined: 11 May 2005
Posts: 4884

PostPosted: Fri Apr 02, 2010 11:41 am    Post subject: Reply with quote

I would recommend to use the function FormatDateTime to add date/time to the filename.

For example:

Code:
Bookmark_SaveWebDocBinary(Handle, "c:\folder\filename " + FormatDateTime("yyyy-mm-dd hh-nn-ss", Now) + ".pdf")

_________________
Martin Aignesberger [SUPPORT]
Back to top
View user's profile Send private message
ifen



Joined: 13 Aug 2009
Posts: 12

PostPosted: Fri Apr 02, 2010 12:15 pm    Post subject: Reply with quote

Thanks Martin ! Wink
The code becomes :

Code:
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_SaveWebDocBinary(Handle, "c:\folder\filename " + FormatDateTime("yyyy-mm-dd hh-nn-ss", Now) + ".pdf")
   End If
End Sub
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.website-watcher.com Forum Index -> Plugins and Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group