Announcement

Collapse
No announcement yet.

Capture2Image + Deleting File

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • travisdh
    replied
    Thanks Jon,

    Works Perfect

    Leave a comment:


  • jon00
    replied
    Travis,

    Try version 1.02 on my site.

    To update, just replace the script and add the following entry under each [Capture] entry in the ini file:

    DelFile=1

    This will attempt to delete the image file first before the next capture.

    Leave a comment:


  • Pete
    replied
    I do this relating to one picture grab. Not really sure if this will help you.

    PHP Code:
    Sub Main(byVal Parm As Object

    Dim Result As String hs.GetURL("http://127.0.0.1","/Temperature.asp?Page=trend",TRUE,9999
    'Wait 40 seconds for page to load 
    For X As Integer = 1 to 50 
        hs.waitsecs(1) 
    Next 

    Dim sLastName as String = “”

    Dim dLastDate as Date = #1/1/1900#

    Dim oFileList As String() = System.IO.Directory.GetFiles(hs.GetAppPath & "\html\mcsTemp”, "*.jpg")

    For Each sFile As String In oFileList

       Dim oFile As System.IO.FileInfo = New System.IO.FileInfo(sFile)

       Dim dDate As Date = oFile.LastWriteTime

       If dDate > dLastDate then

          sLastName = oFile.Name

          dLastDate = dDate
          
       End if

    Next

    If sLastName <> “” then

        My.Computer.FileSystem.CopyFile(hs.GetAppPath & "\html\mcsTemp\” & sLastName,hs.GetAppPath & "\HTML\Images\wunderground\mcs.jpg",TRUE) 

    End if

    hs.writeLog("Name""Source: "&sLastName)
    ' hs.writeLog ("MCSource", "File is"&FileLen("C:\Program Files\HomeSeer 2\HTML\mcsTemp\"&sLastName)&" Bytes at "&filedatetime("C:\Program Files\HomeSeer 2\HTML\mcstemp\"&sLastName))
    hs.writeLog ("MCSJPG""is "&FileLen("C:\Program Files\HomeSeer 2\HTML\Images\wunderground\mcs.jpg")&" Bytes at "&filedatetime("C:\Program Files\HomeSeer 2\HTML\Images\wunderground\mcs.jpg"))

    end sub 

    Leave a comment:


  • travisdh
    started a topic Capture2Image + Deleting File

    Capture2Image + Deleting File

    Hi Jon00,

    I think it might just be a me thing, but I am noticing when i am using the Capture2Image thing, if the file I am trying to save to currently exists, it does not appear to overwrite the file itself at times.

    Is there a script command I can run that will delete the file prior to running the Capture2Image script?

    I can set the directory etc fine, and the file is being made, but just not getting overwritten. The file itself is TOOM_Melways.png

    Thanks
Working...
X