Page 1 of 1

Email Webcam image from Housebot

Posted: Tue May 18, 2010 11:17 am
by raptor_demon
Hi,

I was playing withthe email sender, is there a way to attach a file to the emails?

What i am looking todo is email myself a webcam image when the door bell is pressed.

Thanks

Raptor

Re: Email Webcam image from Housebot

Posted: Tue May 18, 2010 11:55 am
by ScottBot
Unfortunately, no. It's a pretty bare-bones email sending plugin.

It wouldn't surprise me if there was some command line email sending program somewhere that would allow attachments and you could just launch it when you needed to send.

Re: Email Webcam image from Housebot

Posted: Wed May 19, 2010 6:02 pm
by Richard Naninck
You can use this to send emails with attachments from script within HouseBot. Please try to filter out what is needed for your setup. The attachment and email sending part should be easy to filter. This does exactly what you describe.

Code: Select all

'-------------------------------------------------------
'- Grab Image, Create Log and EMail Image --------------
'-------------------------------------------------------
Sub Grab_DoorbellImage()
Dim MyShell
Dim CommandString
Dim ImageDateTime
Dim Image
Dim objImg
Dim iMsg
Dim iConf
Dim Flds

Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort   = 2
Const cdoSMTPServer      = "http://schemas.microsoft.com/cdo/configuration/smtpserver"

	Set MyShell = CreateObject("WScript.Shell")
	Set objImg  = CreateObject("ImageMagickObject.MagickImage.1")
	Set iMsg    = CreateObject("CDO.Message")
	Set iConf   = CreateObject("CDO.Configuration")
	Set Flds    = iConf.Fields
	
	With Flds
		.Item(cdoSendUsingMethod) = cdoSendUsingPort
		.Item(cdoSMTPServer)      = GetPropertyValue("EMail.Account0 Server")
		.Update
	End With
	
	SetPropertyValue "News Timer.Running", "Yes"
	RestoreRemote()
	OpenRemotePanel("Browser")
	SetPropertyValue "Browser.Start Site", "http://192.168.0.5:4716"
	
	Sleep 5000
	SetPropertyValue "Mouse Status.Action", "Login CamDVR"
	
	Sleep 3500
	SetPropertyValue "Mouse Status.Action", "Click Mouse^left,756,622,1"
	
	Sleep 1000
	ImageDateTime = L_Pad(Day(Now), 2, "0") & "-" & L_Pad(Month(Now), 2, "0") & "-" & Year(Now) & " - " & L_Pad(Hour(Now), 2, "0") & "." & L_Pad(Minute(Now), 2, "0") & "." & L_Pad(Second(Now), 2, "0")
	Image         = ImagePath & "Deurbel_" & ImageDateTime & ".jpg"
	CommandString = """C:\Program Files\Meedio\Meedio HouseBot\Config\AutoHome\Programs\CmdCapture.exe""" & _
	                " /f " & """Deurbel_" & ImageDateTime & ".jpg"" /d " & """C:\Program Files\Meedio\Meedio HouseBot\Config\AutoHome\Deurbel""" & " /q 80"
        Call MyShell.Run(CommandString, 0, True) 'True wacht zodat pas naar het Start Panel wordt gegaan na de grab
	OpenRemotePanel("Start")
	Call WriteLog("Deurbel_" & ImageDateTime)
	Call objImg.Convert(Image, "-crop" ,"691x509+14+108", Image)
	
	Sleep 2000

	With iMsg
    	    Set .Configuration = iConf
		.To            = GetPropertyValue("EMail.Account0 User")
		.From          = GetPropertyValue("EMail.Account0 User")
		.Subject       = "Deurbel"
		.TextBody      = ""
		.AddAttachment Image
		.Send
	End With
		
	Set Flds    = Nothing
	Set iConf   = Nothing
	Set iMsg    = Nothing
	Set objImg  = Nothing
	Set MyShell = Nothing
End Sub

Re: Email Webcam image from Housebot

Posted: Mon Jun 28, 2010 10:33 am
by raptor_demon
Worked great thanks!