Announcement

Collapse
No announcement yet.

This Day in History is History

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

  • This Day in History is History

    Well it's lasted for like 5 years without an issue, but it looks like the Yahoo page the This Day in History script pulls data from has finally changed, at least I think that's why I'm getting the following error:

    5/5/2007 10:31:35 AM - Error - Running script, script run or compile error in file: on_this_day1.txt5:Invalid procedure call or argument: 'Mid' in line 42 More info: Invalid procedure call or argument: 'Mid'

    The Yahoo site is actually pulling data from the The History Channel site which has an RSS feed, would it be better now a days to just pull the data from there? Here's the site if anyone would be willing to help put a script together:

    http://www.history.com/tdih.do

    and the RSS Feed is at:

    http://feeds.feedburner.com/aetn/history/thisday

    I tried to pull some vb language from another script and piece it together, but still can't get it to work... Any help would be awesome!

    John

  • #2
    I suspected that it was broke, when I kept hearing about the Shaker Founder Ann Lee was born on March 1st, 1736 every morning since March 1st at 6:30 in the morning when the script ran:

    March 1 - SHAKER FOUNDER ANN LEE BORN in 1736 Ann Lee, the founder of the United Society of Believers in Christ's Second Appearing, a group commonly known as the Shakers, was born in Manchester, England. "Mother" Ann broke from the Quakers in 1770 to establish her own Christian movement based on celibacy, sexual equality, energetic worship, pacifism and a communal economy. Four years later, Lee led her flock to the New World, and in the years between the American Revolution and the Civil War, Shakers in America numbered 17,000. Today, the Shakers are best known for their simple yet masterfully designed furniture and architecture.

    I'm not that good at writing or fixing these types of complex scripts, so I would second the motion to support someone in fixing it.

    -Todd

    ____________________________________________________________ ________________
    HS2Pro: 2.5.0.81 :: HS3Pro (beta) || Plugins:| SmartHome PowerLinc USB, Global Cache, BLBackup, DooCPU Monitor, DooMotion, BLOutlook, BLIcon, BLOutgoingCalls, OutgoingCalls, ROC-Rnd, HSTouch iPhone, UPS Monitor, DooMenuBar, BLSpeech, HSTouch Server, WAF AB8SS, mcsTemperature, VWS, BLChart, RFXCOM, ISY Insteon, iAutomate RFID, iTunes, NetCAM, DSC Security, Nest

    Comment


    • #3
      If you guys find an XML feed for this day in history I can rework the script for you guys.
      -Rupp
      sigpic

      Comment


      • #4
        Working Here...

        On This Day in History
        May 5 - IRA'S BOBBY SANDS DIES in 1981While imprisoned in Belfast, Bobby Sands led other members of the Irish Republican Army on a hunger strike in protest against being treated as criminals rather than political prisoners. The 27-year old Sands had been elected to Parliament while serving his 14-year sentence for weapons possession. After refusing food for 66 days, Sands died on May 5, 1981.


        ....JG
        HS2PRO - Ocelot, SecuIR, Secu16, Attendence Management Alarm Interface, X-10, LCD Studio VFD Display, 3 Apexis IP Cams, Custom Software Interfaces, GMQ Geiger Graphing
        HS3PRO - Testing

        Comment


        • #5
          Hate fixing other people's code (and haven't even looked at it), but this working VB.Net code snippet may give you pointers, or be of use directly.

          Code:
          ' This Day in History script
          ' Fuego
           
          Imports System.Xml
           
          Sub ThisDayInHistory()
              Const URL As String = "http://feeds.feedburner.com/aetn/history/thisday"
              Const Node As String = "rss/channel/item"
              Dim XMLDoc As New XmlDocument
              XMLDoc.Load(URL)
              Dim XMLNode As XmlNode = XMLDoc.SelectSingleNode(Node)
              Dim Title As String = StripHTML(XMLNode.Item("title").InnerText)
              Dim Descr As String = StripHTML(XMLNode.Item("description").InnerText)
              hs.Speak("This day in history.")
              hs.Speak(Title)
              hs.Speak(Descr)
          End Sub
           
          Private Function StripHTML(ByVal HTML As String) As String
              Return System.Text.RegularExpressions.Regex.Replace(HTML, "<[^>]*>", "")
          End Function

          Comment


          • #6
            I get an error when I try and run the code snippet above, which I saved as a .vb file.

            5/7/2007 8:54:12 AM Info Running script in background: thisdayinhistory.vb
            5/7/2007 8:54:12 AM Error Script compile error: Type 'XmlDocument' is not defined.on line 19
            5/7/2007 8:54:12 AM SCR Option Strict OffImports System.Xmlimports Schedulerimports SystemPublic Module scriptcode5#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End Region Sub ThisDayInHistory() Const URL As String = "http://feeds.feedburner.com/aetn/history/thisday" Const Node As String = "rss/channel/item" Dim XMLDoc As New XmlDocument XMLDoc.Load(URL) Dim XMLNode As XmlNode = XMLDoc.SelectSingleNode(Node) Dim Title As String = StripHTML(XMLNode.Item("title").InnerText) Dim Descr As String = StripHTML(XMLNode.Item("description").InnerText) hs.Speak("This day in history.") hs.Speak(Title) hs.Speak(Descr)End Sub Private Function StripHTML(ByVal HTML As String) As String Return System.Text.RegularExpressions.Regex.Replace(HTML, "<[^>]*>", "")End FunctionEnd Module

            Did I miss something simple here?

            Comment


            • #7
              In your settings.ini under [settings] add the following entry:

              ScriptingReferences=System.XML;System.XML.dll

              It should now work after a reboot of HS.
              Jon

              Comment


              • #8
                Thanks for pointing that out Jon.

                Other handy ones to have (whilst you're editing it) - IMHO - are:

                ScriptingReferences = System.XML;System.XML.dll,System.Web;System.Web.dll,System.D ata;System.Data.dll,System.Management;System.Management.dll

                (Not sure why a space shows up in D ata above - it shouldn't be there, but I can't remove it)

                Comment


                • #9
                  Thanks, I made that entry in my ini file, and it did fix the error I posted above.

                  This is the new error.

                  5/8/2007 12:27:18 PM Error 1 Running script thisdayinhistory.vb :method not found

                  Comment


                  • #10
                    Change:

                    Sub ThisDayInHistory()

                    to

                    Sub Main(parm as object)

                    see if that works.
                    Jon

                    Comment


                    • #11
                      That fixed it. Thanks a lot, I'll have this run every morning after the House status changes to Awake.

                      Comment


                      • #12
                        It works great.... Thanks Jon!!

                        Comment


                        • #13
                          So I haven't been following this thread, but... Can someone post the resulting script that does work? I'd rather not try and follow the recipe steps in the thread.

                          Steve

                          Comment


                          • #14
                            If not already in your settings.ini file, add the following:

                            ScriptingReferences=System.XML;System.XML.dll

                            Reboot Homeseer if you need to add it.

                            Next copy the script below in a text editor and call it ThisDayHistory.vb

                            PHP Code:
                            ' This Day in History script
                            Fuego
                             
                            Imports System
                            .Xml
                             
                            Sub Main
                            (parm as object)
                                Const 
                            URL As String "http://feeds.feedburner.com/aetn/history/thisday"
                                
                            Const Node As String "rss/channel/item"
                                
                            Dim XMLDoc As New XmlDocument
                                XMLDoc
                            .Load(URL)
                                
                            Dim XMLNode As XmlNode XMLDoc.SelectSingleNode(Node)
                                
                            Dim Title As String StripHTML(XMLNode.Item("title").InnerText)
                                
                            Dim Descr As String StripHTML(XMLNode.Item("description").InnerText)
                                
                            hs.Speak("This day in history.")
                                
                            hs.Speak(Title)
                                
                            hs.Speak(Descr)
                            End Sub
                             
                            Private Function StripHTML(ByVal HTML As String) As String
                                
                            Return System.Text.RegularExpressions.Regex.Replace(HTML"<[^>]*>""")
                            End Function 
                            Now run the script via an event!
                            Jon

                            Comment


                            • #15
                              hmm...the day in history thing is still working fine for me...

                              I think I had tweaked something a while ago...but it's still working fine.

                              --Dan
                              Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                              Comment

                              Working...
                              X