nick7920 Senior Member 
          
 
  Joined: March 04 2008 Location: United States
 Online Status: Offline Posts: 193
          | 
        
         
          
           | Posted: September 24 2011 at 11:36 | IP Logged
		     | 
                    
            		  
           | 
           
          
           
  | 
           
          
I have this vbscript to get the image from the ipcamera which runs fine. If I use the ph_run it works fine,  but using ph_runscript_0 it seems to get the image from cache and it will get new one after long time ,seems like it left the connection open. It may be working for ph_run because when you are done, it closes the command window and that will close the connection. Can someone look at the Vb code and point me to right direction.
 
 ph_run code
 ph_run('cmd /c "c:\sendemail\vb\getcam.vbs"')
 
 ------------------------------------------------
 Option Explicit
 Dim DataBin 
 Dim HTTPGET 
 Set HTTPGET = CreateObject("Microsoft.XMLHTTP") 
 HTTPGET.Open "GET","http://XX.XX.XX.XX/snapshot.cgi?user=test&pwd=test", False 
 HTTPGET.Send 
 DataBin = HTTPGET.ResponseBody 
 Const adTypeBinary=1 
 Const adSaveCreateOverWrite=2 
 
 Dim SendBinary 
 Set SendBinary = CreateObject("ADODB.Stream") 
 SendBinary.Type = adTypeBinary 
 SendBinary.Open 
 SendBinary.Write DataBin 
 SendBinary.SaveToFile "c:\powerhome\web\IPsnapshot.jpg", adSaveCreateOverWrite  
 ---------------------------------------------------------
 
 and code for ph_runscript_0
 ph_runscript_0(0, "c:\sendemail\getipsnap.vbs","sub1")
 
 @language="vbscript" 
 Sub sub1() 
 
 Dim DataBin 
 Dim HTTPGET 
 Set HTTPGET = CreateObject("Microsoft.XMLHTTP") 
 
 HTTPGET.Open "GET","http://xx.xx.xx.xx/snapshot.cgi?user=test&pwd=test", False 
 HTTPGET.Send 
 DataBin = HTTPGET.ResponseBody 
 Const adTypeBinary=1 
 Const adSaveCreateOverWrite=2 
 Dim SendBinary 
 Set SendBinary = CreateObject("ADODB.Stream") 
 SendBinary.Type = adTypeBinary 
 SendBinary.Open 
 SendBinary.Write DataBin 
 SendBinary.SaveToFile "C:\powerhome\web\IPsnapshot.jpg", adSaveCreateOverWrite 
      ph.usermessage("Getipsnap from vb script") 
 
 HTTPGET.abort
 
 End Sub 
 -------------------------------------------------------
 again it seems like more of a Vbscript command to close the connection than powerhome.
 
 
 Thanks for any help
 P.S. any one who has the foscam Ip camera can use this code and will to do the job, except my little short coming till the fix. right now using from Ph_run.
 
 
 
 
         |