Announcement

Collapse
No announcement yet.

How do I modify this script?

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

  • Msekelsky
    replied
    Since I am sure I have it wrong (and currently have lines in many places trying to figure out where they need to be) I thought it better to post the clean copy. I editted the last post and bolded the new lines.

    Leave a comment:


  • Rupp
    replied
    Where did you make your edits? I do not see any place the messages are set as being read.

    -Rupp

    Leave a comment:


  • Msekelsky
    replied
    This is the original script (I think last updated by jon00). I left out the instructional comments. From looking at other scripts I think I need HSPline, CurrentMessage=hsp.MBFirstUnreadMessage(HSPLine, MB) and hsp.MBMarkRead(CurrentMessage)

    ============================
    sub main()
    dim mb
    dim messages
    dim mfile
    dim count
    dim i
    dim a
    dim b
    dim c
    dim d
    dim HSPLine

    HSPLine=1

    set mb=hsp.MBGetDefault ' get the default mailbox
    set messages = mb.messages ' get the collection of messages
    count = messages.count ' get the total number of messages
    hs.SetDeviceStatus "M17", 2 ' set playing messages on
    hs.SetDevicestatus "M1",3 ' turn off play/skip
    CurrentMessage=hsp.MBFirstUnreadMessage(HSPLine, MB)
    if count=0 then
    hs.speak "There are no phone messages",1
    else
    if count=1 then
    hs.speak "There is "& cstr(count) & " phone message.",1
    else
    hs.speak "There are "& cstr(count) & " phone messages.",1
    end if
    end if
    do while count <>0
    i=i+1
    set mfile = messages(count) ' get a reference to a message of type message_file
    hs.speak "Message " & i, true
    hs.MEDIAFilename="C:\Program Files\HomeSeer\messages\"&mfile.filename
    hs.MEDIAPlay
    CurrentMessage=hsp.MBFirstUnreadMessage(HSPLine, MB)

    hsp.MBMarkRead(CurrentMessage)

    do
    ' allow other things to run
    hs.WaitEvents
    a=hs.Devicestatus("M1")
    ' Is Play/Skip pressed, then stop playing message & exit
    if a=2 then
    hs.SetDevicestatus "M1",3
    hs.MEDIAStop
    exit do
    end if
    ' Is message done playing, then exit
    if hs.MEDIAIsPlaying=0 then
    exit do
    end if
    ' Check to see if stop pressed
    c=hs.Devicestatus("M4")
    if c=2 then
    hs.MEDIAStop
    exit do
    end if
    loop
    ' Ask user if they want to delete or save message
    if c<>2 then
    hsp.MBMarkRead(CurrentMessage)
    hs.speak "Please delete or save the message",1
    end if
    ' HSP can't delete file if Media player has file; reselect file to any file
    hs.MEDIAFilename="C:\Program Files\HomeSeer\messages\temp.wav"
    hs.MEDIAStop
    do

    ' allow other things to run
    hs.WaitEvents
    ' exit loop on stop
    c=hs.Devicestatus("M4")
    if c=2 then
    count=0
    hs.SetDeviceStatus "M4", 3
    hs.SetDeviceStatus "M17", 3
    exit do
    end if
    ' wait for delete choice
    b=hs.Devicestatus("M2")
    if b=2 then
    hsp.MBDeleteMessage mfile.filename
    hs.speak "Message deleted"
    hs.SetDeviceStatus "M2", 3 'set off
    exit do
    end if
    ' wait for save choice
    b=hs.Devicestatus("M3")
    if b=2 then
    hs.speak "Message saved"
    hs.SetDevicestatus "M3",3
    exit do
    end if
    'count to automatically exit loop after a period of time
    d=d+1
    if d>20000 then
    d=0
    exit do
    end if

    loop
    ' decrement message counter
    if i = 0 then
    i=count+1
    end if
    count=count-1
    loop
    ' Clean up, clear flags

    hs.speak "Messages Complete",1
    hs.SetDeviceStatus "M17",3 'set off Playing Messages flag
    hs.SetDeviceStatus "M18",3 'set off phone message flag
    hs.setdevicestring "M18","<img src='Telephonestatic.gif'> No telephone messages"
    hs.SetDeviceStatus "M4",3 'set off stop

    end sub

    [This message was edited by MSekelsky on Wed, 18 February 2004 at 09:34 PM.]

    [This message was edited by MSekelsky on Wed, 18 February 2004 at 09:35 PM.]

    Leave a comment:


  • Rupp
    replied
    Post your script and we'll have a look.

    -Rupp

    Leave a comment:


  • Msekelsky
    started a topic How do I modify this script?

    How do I modify this script?

    Is anybody familiar with this script?. It allows you to play messages via X-10. We use this all the time but nothing in the script marks the message as "read." I have been playing around with it (I am pretty much a script novice) and have gotten to where I can mark all messages as read except the last message. I am assuming this is not a hard thing to do, but I'm stumped.
Working...
X