X10 Community Forum

🖥️ActiveHome Pro => SDK => Topic started by: steinie44 on March 18, 2007, 02:33:15 PM

Title: X10 Talk - Verbose activity monitor
Post by: steinie44 on March 18, 2007, 02:33:15 PM
Here is a little vb5 program to try :-[
Small, but packs a punch................ :-
Let me know what you think! :o

------------------------------------------------------------------------------------------------------------------------- ;)

'for Microsoft Visuel Basic 2005 Express Edition
'X10Talk By: James D. Steinbrecher
'Copyright (C) 03-15-2007
'Permission granted for personal use - not for sale!

Imports ActiveHomeScriptLib 'Get this at http://www.activehomepro.com/sdk/sdk-info.html
Public Class Form1
    Public WithEvents ActiveHomeObj As ActiveHome
    Public Path As String = "C:Program FilesVisuel_BasicClocksCallie" 'Where the .wav files are
    Public dir As New IO.DirectoryInfo(Path)
    Public f As IO.FileInfo
    Public File As String = ""
    Public HC As String
    Public UC As String
   

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        Dim size As Long
        Dim creationTime As DateTime
        Dim N As String
        Dim S As String
        Dim T As String
        Try
            ActiveHomeObj = CreateObject("X10.ActiveHome")
        Catch ex As Exception
            MsgBox(ex)
        End Try


        'Create a form and put a richText window on it called: Out
        'make the box about 675 x 400 size
        'for the instructions and directory to be listed.
        'Use Courier New 10 pitch font for directory alignment.

        Out.AppendText("Steinie's X10 Verbose Activity Log (C) Instructions:" & vbCrLf)
        Out.AppendText("Simply place your .wav files into a folder and set the Path name to it" & vbCrLf)
        Out.AppendText("The .wav files needed are:" & vbCrLf)
        Out.AppendText("16 files named a - p where the voice simply says the letter" & vbCrLf)
        Out.AppendText("16 files named 1 - 16 where the voice simply says the number" & vbCrLf)
        Out.AppendText("4 files named: recvplc, recvrf, queryplc and sendrawplc" & vbCrLf)
        Out.AppendText("the voice says: receive plc, receive rf, query plc and send raw rf" & vbCrLf)
        Out.AppendText("16 files named for the 16 functions where the voice simply says:" & vbCrLf)
        Out.AppendText("the function: on, off, bright, dim, allunitsoff, alllightsoff " & vbCrLf)
        Out.AppendText("Up to 256 files named a1 - p16, one for each House and Unit you have" & vbCrLf)
        Out.AppendText("the voice says: 'description if your module' " & vbCrLf)
        Out.AppendText("For rf commands you need a voice  for all that you use like" & vbCrLf)
        Out.AppendText("panleft, panright, CamGoPosition1, CamCenter and FocusUp" & vbCrLf)
        Out.AppendText("DONT BE SET-BACK by the number of files used!" & vbCrLf)
        Out.AppendText("The program will run with just a few, or none at all!" & vbCrLf)
        Out.AppendText("So, play around with it and build your voices as you go...." & vbCrLf)
        Out.AppendText("Note: This PROGRAM MUST BE RUNNING at all times, to function!!!" & vbCrLf)
        Out.AppendText("Note: A CM-15 MUST BE CONNECTED TO THE COMPUTER  to function!!!" & vbCrLf)
        Out.AppendText("Copyright (c) 2007 by James D. Steinbrecher" & vbCrLf)
        Out.AppendText("Permission is granted for Free use - Not for sale!" & vbCrLf)
        Out.AppendText(vbCrLf)
        Out.AppendText("My wav files are:" & vbCrLf)
        Out.AppendText(vbCrLf)

        'You can get free .wav voices at: http://www.blindsoftware.com/cepstral.asp
        'or at: http://www.research.att.com/~ttsweb/tts/demo.php

        For Each f In dir.GetFiles("*.wav")
            Name = f.Name
            N = Name.ToString.PadRight(25)
            size = f.Length
            S = Val(size).ToString.PadLeft(15)
            creationTime = f.CreationTime
            T = creationTime.ToString.PadLeft(25)
            Out.AppendText(N & S & T & vbCrLf)
        Next f
        Out.AppendText(vbCrLf)

    End Sub
   
    Sub ActiveHome_RecvAction(ByVal bszRecv As Object _
 , ByVal vParm1 As Object _
 , ByVal vParm2 As Object _
 , ByVal vParm3 As Object _
 , ByVal vParm4 As Object _
 , ByVal vParm5 As Object _
 , ByVal vReserved As Object) Handles ActiveHomeObj.RecvAction

        If bszRecv = "recvrf" And vParm3 <> "0" Then GoTo done 'Only want key-down on RF

        ' Transmission Type: bszRecv names are: recvrf, recvplc, queryplc and sendrawrf
        File = bszRecv
        Call Playit()

        'House and Unit code "A1 - P16" is in vParm1
        'HC = letters A-P
        HC = Mid(vParm1, 1, 1)
        File = HC
        Call Playit()

        'UC = number 1-16
        UC = Mid(vParm1, 2, Len(vParm1) - 1)
        File = UC
        Call Playit()

        'House and Unit Codes for description of your modiles a1 - p16
        File = vParm1
        Call Playit()

        'Functions like: On, Off, Bright, Dim, PanLeft, PanRight
        File = vParm2
        Call Playit()

        'Not using vParm4 and vParm5 and vReserved
        'Out.AppendText(vParm4 & vbCrLf & vParm5 & vbCrLf & vReserved)
done:

    End Sub

    Sub Playit() 'will only play if the file is there!
        File = LCase$(File)
        For Each f In dir.GetFiles("*.wav")
            Name = LCase$(f.Name)
            If Name = File + ".wav" Then
                My.Computer.Audio.Play(Path + File + ".wav", AudioPlayMode.WaitToComplete)
            End If
        Next
    End Sub

End Class





Title: Re: X10 Talk - Verbose activity monitor
Post by: steinie44 on March 20, 2007, 04:30:14 AM
 :D
     'You can add up-to more then 4096 .wav files to play a .wav like: p12on.wav, g7off.wav, n14panleft.wav
        File = vParm1 + vParm2
        Call Playit()
------------------------------------------------------------------------------------------------------------------ :)
        'Not using vParm4 and vParm5 and vReserved
        'Out.AppendText(vParm4 & vbCrLf & vParm5 & vbCrLf & vReserved)
done:

    End Sub :P

 :o I use p12on for my alarm - to play On The Road Again - rename On The Road Again.wav to p12on.wav
 :o