Hi!
I would be grateful if someone has the knowledge to help me with some visual basic code. I simply want the temperature for a known sensor to a TextBox!
So if anyone has come across code for VB.Net or VB6 would was very helpful.
Don't understand how to translate the example formulas available from C or Java?
Only anything related to Visual Basic is greatly appreciated! Helpful VB links also!
I've searched the forum with no luck.
Thanks in advance
Tellstick Duo in Visual Basic
Moderator: Telldus
Re: Tellstick Duo in Visual Basic
'vbs send mail with values temperature, tested T Duo and Win 7
-----------------------
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath1 = "Software\Telldus\TelldusCenter\com.telldus.sensors\sensors\0\values\values\0\values"
strValueName1 = "value"
oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath1,strValueName1,strValue1
strKeyPath2 = "Software\Telldus\TelldusCenter\com.telldus.sensors\sensors\1\values\values\0\values"
strValueName2 = "value"
oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath2,strValueName2,strValue2
'Preparation mail
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Status temperature"
objMessage.From = "name@gmail.com"
objMessage.To = "to@gmail.com"
objMessage.TextBody = "Temperature1 = " & strValue1 & " C " & "temperature = " & strValue2 & " C"
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... /sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... smtpserver") = "smtp.gmail.com"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... thenticate") = 1
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... ndusername") = "name"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... ndpassword") = "password"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... serverport") = 465
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... smtpusessl") = true
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... iontimeout") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
-----------------------
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath1 = "Software\Telldus\TelldusCenter\com.telldus.sensors\sensors\0\values\values\0\values"
strValueName1 = "value"
oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath1,strValueName1,strValue1
strKeyPath2 = "Software\Telldus\TelldusCenter\com.telldus.sensors\sensors\1\values\values\0\values"
strValueName2 = "value"
oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath2,strValueName2,strValue2
'Preparation mail
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Status temperature"
objMessage.From = "name@gmail.com"
objMessage.To = "to@gmail.com"
objMessage.TextBody = "Temperature1 = " & strValue1 & " C " & "temperature = " & strValue2 & " C"
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... /sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... smtpserver") = "smtp.gmail.com"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... thenticate") = 1
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... ndusername") = "name"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... ndpassword") = "password"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... serverport") = 465
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... smtpusessl") = true
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/config ... iontimeout") = 60
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send