Announcement

Collapse
No announcement yet.

CNN Breaking News script

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

    #16
    Pete,

    I sent you an email on the two addresses I had for you from the NCID / SnevlCID dialogs we've had. Hopefully at least one of those still works. Let's work this off the board, and if we find there is a change required one of the two of us can post it back here for others.

    If you don't get my email, send me a PM with your current email address and I'll try again.

    Steve

    Comment


      #17
      Originally posted by GreenAcres View Post
      I have also been seeing these repeats for some time now.
      Thom,

      I know I've periodically made some changes to the script for myself and my brother, and the more I think about it I think I did do some more stuff because of repeats, but I think it was over a year ago. Anyway, I asked Pete to send me the version he is using and I can compare it to what I have. I have some other custom things in my version, but since it doesn't repeat my guess is I can compare the two and figure out what to add into his.

      As I mentioned to Pete in the email I sent him, this is why freely distributed source code on the scripts is both a good thing and a bad thing. I've always supported the idea of sharing scripts. I don't even remember who wrote the CNN script, but it clearly has LOTS of people using it. I know I translated it to VB.NET and made a few changes, but I would be others have also made other changes, and there are probably 15-20 different versions of it in use now.

      Steve

      Comment


        #18
        I hope I'm not violating someone's ownership of this script. I've updated it to be a more "pure" translation to VB.NET, and fixed some of the issues posted here (e.g. repeating the same alert several times). I've been using it here for a few days, but I can't say for certain there are no more issues. Please let me know if I've broken anything.

        Steve
        Attached Files

        Comment


          #19
          Thanks for updating the CNN script Steve.

          Happy New Year!
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
          Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
          HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

          HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
          HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

          Comment


            #20
            I see the script has been downloaded 10 times, but I have one person who is reporting the script crashing with a run-time error every time it is run. It doesn't do that here, so I'm curious if anyone else is seeing an error. If so, can you either post here or send me a PM with the error message?

            Sorry for the inconvenience.

            Steve

            Comment


              #21
              Just ran it and got the following error in th HS log....

              Scripting runtime error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at scriptcode4.scriptcode4.Main(String strMode) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Scheduler.VsaScriptHost.Invoke(String ModuleName, String MethodName, Object[] Arguments)

              Comment


                #22
                Well, rats. I truly appologize. I'm not having the error here, so I'm not sure what is going on.

                If you can, please try this version, and run it with debug on. This version doesn't fix anything, but I've put in some stuff to catch the exception so that I can tell where it is happening.

                To run in debug mode, just add "debug" as an argument to the Main routine in your event. That is, instead of:

                Custom_CNN.vb("Main","")

                do this

                Custom_CNN.vb("Main","debug")

                Post back here with what prints out when it fails again. Thanks for helping.

                Steve

                P.S. Rename the script to Custom_CNN.vb by removing the .TXT at the end.
                Attached Files

                Comment


                  #23
                  Hope this helps....

                  It seemed to run OK

                  12/30/2009 1:21:44 PM - Event - Event Trigger "Test CNN"
                  12/30/2009 1:21:44 PM - Event - Running script in background: Custom_CNN.vb("Main","debug")
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:strIniFileName] CNNsettings.ini
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:bEdit] False
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:virtualdevice] v10
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:speak] True
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:announceschedule] 08:00-18:30
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variablelaywav] True
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:wavfile] c:\Program Files\HomeSeer HS2\wavs\cnn.wav
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:notify] True
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:notifyschedule] 08:00-16:30
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:subject] CNN News Alert
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:TOaddress] blott@donlen.com
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:FROMaddress] Lottbill@bellsouth.net
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:turnoff] True
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:newsicon] '\images\new_messages1.gif
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:iDaysToKeep] 7
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] [variable:strTriggerEvents]
                  12/30/2009 1:21:44 PM - CNNAlerts - [debug] retrieving http://www.cnn.com/.element/ssi/www/...r.exclude.html
                  12/30/2009 1:21:47 PM - CNNAlerts - [debug] html data: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><script>var cnnDocDomain='';if(location.hostname.indexOf('cnn.com')>0) { cnnDocDomain='cnn.com'; }if(location.hostname.indexOf('turner.com')>0) { cnnDocDomain='turner.com'; }if(cnnDocDomain) { document.domain = cnnDocDomain;}</script><script>function cnnGetId(query){ var keyValPairs = query.split('&'); if(!keyValPairs) { keyValPairs = new Array(); keyValPairs[keyValPairs.length]=query} for(var counter=0;counter<keyValPairs.length;counter++) { var keyVal = keyValPairs[counter].split('='); if(keyVal[0]=='domId') { return keyVal[1]; } }}function cnnSendData(){ var sendRawHtml =''; var docId = cnnGetId(location.search.substring(1)); if(document.mainForm.tuneinnow.value) { sendRawHtml = document.mainForm.tuneinnow.value; } if(document.mainForm.breakingNews.value) { sendRawHtml = document.mainForm.breakingNews.value; } if (sendRawHtml) { top.cnnUpdateCSI(sendRawHtml, docId); }}</script></head><body onload="cnnSendData();"><form name="mainForm"><textarea name="breakingNews"><!--breaking news banner--><div id="cnnBNBBreakingNews"> <table cellpadding="0" cellspacing="0" border="0"> <tr valign="middle"> <td width="181" valign="top"><img src="http://i.a.cnn.net/cnn/.element/img/1.5/ceiling/bnb/breaking_news.gif" alt="" width="181" height="47" hspace="0" vspace="0" border="0"/></td> <td class="right"><div id="cnnNarrowBulletinText">Texas Tech fires coach Mike Leach after accusations he mistreated an injured player, The Associated Press reports. </div></td> </tr> </table></div><!--/breaking news banner--></textarea><textarea name="tuneinnow"></textarea></form></body></html>
                  12/30/2009 1:21:47 PM - CNNAlerts - [debug] breaking news detected
                  12/30/2009 1:21:47 PM - CNNAlerts - [debug] [variable:strOldAlert][No Breaking News]
                  12/30/2009 1:21:47 PM - CNNAlerts - [debug] breaking news:[Texas Tech fires coach Mike Leach after accusations he mistreated an injured player, The Associated Press reports. ]
                  12/30/2009 1:21:47 PM - CNNAlerts - [debug] playing c:\Program Files\HomeSeer HS2\wavs\cnn.wav
                  12/30/2009 1:21:53 PM - TTS - Speak ():Your attention please. This is a C N N breaking news alert.
                  12/30/2009 1:21:53 PM - TTS - Speak ():Texas Tech fires coach Mike Leach after accusations he mistreated an injured player, The Associated Press reports.
                  12/30/2009 1:21:53 PM - CNNAlerts - [debug] email notification has been sent
                  12/30/2009 1:21:53 PM - CNNAlerts - [debug] updating virtualdevice string with the news alert
                  12/30/2009 1:21:53 PM - CNNAlerts - [debug] turning virtualdevice ON

                  Comment


                    #24
                    So merely adding some debug made the problem go away?! I hate when that happens. Well, you can probably go back to turning off the debug. Maybe the exception catching stuff I put in somehow prevents the exception!

                    Steve

                    Comment


                      #25
                      Just ran it again and here ios the log....

                      12/30/2009 1:26:14 PM Event Event Trigger "Test CNN"
                      12/30/2009 1:26:14 PM Event Running script in background: Custom_CNN.vb("Main","debug")
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:strIniFileName] CNNsettings.ini
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:bEdit] False
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:virtualdevice] v10
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:speak] True
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:announceschedule] 08:00-18:30
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variablelaywav] True
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:wavfile] c:\Program Files\HomeSeer HS2\wavs\cnn.wav
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:notify] True
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:notifyschedule] 08:00-16:30
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:subject] CNN News Alert
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:TOaddress] blott@donlen.com
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:FROMaddress] Lottbill@bellsouth.net
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:turnoff] True
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:newsicon] '\images\new_messages1.gif
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:iDaysToKeep] 7
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:strTriggerEvents]
                      12/30/2009 1:26:14 PM CNNAlerts [debug] retrieving http://www.cnn.com/.element/ssi/www/...r.exclude.html
                      12/30/2009 1:26:14 PM CNNAlerts [debug] html data:
                      <!--breaking news banner-->
                      <div id="cnnBNBBreakingNews">
                      <table cellpadding="0" cellspacing="0" border="0">
                      <tr valign="middle">
                      <td width="181" valign="top"><img src="http://i.a.cnn.net/cnn/.element/img/1.5/ceiling/bnb/breaking_news.gif" alt="" width="181" height="47" hspace="0" vspace="0" border="0"/></td>
                      <td class="right"><div id="cnnNarrowBulletinText">Texas Tech fires coach Mike Leach after accusations he mistreated an injured player, The Associated Press reports. </div></td>
                      </tr>
                      </table>
                      </div>
                      <!--/breaking news banner-->

                      12/30/2009 1:26:14 PM CNNAlerts [debug] breaking news detected
                      12/30/2009 1:26:14 PM CNNAlerts [debug] [variable:strOldAlert][Texas Tech fires coach Mike Leach after accusations he mistreated an injured player, The Associated Press reports.]
                      12/30/2009 1:26:14 PM CNNAlerts [debug] old breaking news, this will not be announced and virtualdevice will not be updated

                      Comment


                        #26
                        I am having problems also: I am getting this error in the log:
                        Scripting runtime error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at scriptcode9.scriptcode9.Main(String strMode) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Scheduler.VsaScriptHost.Invoke(String ModuleName, String MethodName, Object[] Arguments)
                        I wasnt getting an error until I done the last change, but I wasnt getting any alarts either. This is why I tried the change.
                        Looking for suggestions please.
                        danielbo
                        danielbo

                        Comment


                          #27
                          Originally posted by danielbo View Post
                          I am having problems also: I am getting this error in the log:
                          Daniel,

                          Are you running the version I posted this morning? If not, try that one please, and let me know if the error goes away.

                          Steve

                          Comment


                            #28
                            I just did the one that you have listed below, the other was one from last week.
                            Now I am getting an error of:
                            <TABLE border=0 cellSpacing=2 cellPadding=0 width="100%"><TBODY><TR><TD class=LOGDateTime0 noWrap align=left>12/30/2009 4:56:09 PM </TD><TD class=LOGType0 colSpan=3 align=left>Warning </TD><TD class=LOGEntry0 colSpan=8 align=left>VB Net scripting, could not add assembly referenced from settings.ini: Drawing.dll</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>12/30/2009 4:56:11 PM </TD><TD class=LOGType1 colSpan=3 align=left>ERROR </TD><TD class=LOGEntry1 colSpan=8 align=left>
                            Custom_CNN.vb - Error in block 1: Object reference not set to an instance of an object.


                            </TD></TR></TBODY></TABLE>
                            danielbo

                            Comment


                              #29
                              I have been having problems with the drawings.dll. It comes and goes.

                              Thanks for your help,
                              danielbo
                              danielbo

                              Comment


                                #30
                                Daniel,

                                I'm still not sure which version of the script you are running. I want you to run the one that I posted this morning, in post #22 above (http://board.homeseer.com/showpost.p...5&postcount=22).

                                Isn't that Drawing.dll problem the one I fixed for you a couple of days ago?

                                Steve

                                Comment

                                Working...
                                X