Announcement

Collapse
No announcement yet.

Hs.writeLog command errors

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

    #16
    Originally posted by Bmurph213 View Post
    There is no main function in the event. When you see the screenshot above, it is in edit mode to prove I am not adding (main) in my code. HS4 is doing that automatically and I cannot remove it. This is what is so frustrating and extremely annoying
    In edit mode, you should be seeing this:

    Click image for larger version

Name:	Capture.PNG
Views:	338
Size:	388.7 KB
ID:	1412662

    Once it is saved your final event should look like this:

    Click image for larger version

Name:	Capture1.PNG
Views:	328
Size:	65.8 KB
ID:	1412663
    Jon

    Comment


      #17
      Oh this is wonderful... Now I have to go thorugh the 50 or so scripts I have written and edit the logging calls in every one of them! This is not cool!

      Comment


        #18
        Originally posted by artstein View Post
        Oh this is wonderful... Now I have to go thorugh the 50 or so scripts I have written and edit the logging calls in every one of them! This is not cool!
        Why? This only affects hs.writelog when used as an immediate script command.
        Jon

        Comment


          #19
          Update - It was a bug in HS4. Hence why all the great advice from the forum did not work. HomeSeer notified me it was fixed.
          verified that this works in Script Commands and Events.
          &hs.writeLogEx("Title","Log Text!","" )

          Thanks all for the assistance here.

          Comment


            #20
            One more note for trying to get writeLogEx working.

            I am a VERY long time user of HS back to 1999. Most of my scripts have the file extension of TXT. I was having trouble with HS3 and decided to make the jump to HS4 that I had previously paid for one of the early promo deals.

            I always used writeLog to help debug things and see if I was getting the correct values of some devices that I used to take action in a script. All of the scripts with writeLog now failed in HS4. To get things working I just commented out the writeLog statements.

            It seems that hs.writelogEx (no &n) does NOT work if your script has a TXT extension. It does work if the script has a VB extension.

            For sure a nice HS4 scripting tutorial would be very helpful. And maybe it exists. I can handle the logic flow and the programming but the nuances of things like this just don't seem to be documented anywhere.

            Comment


              #21
              Its not documented because it is a bug and should be reported.

              hs.writelog fails using a .txt script.

              Code:
              Sub Main()
              
              hs.writelog "Test","test"
              
              End Sub
              Running script, script run or compile error in file: Test.txt430:Class doesn't support Automation: 'hs.writelog' in line 3 More info: Class doesn't support Automation: 'hs.writelog'

              hs.writelogEx does work however:

              Code:
              Sub Main()
              
              hs.writelogEx "Test","test","#FF0000"
              
              End Sub
              Legacy-Plugin/Script Test test
              Jon

              Comment


                #22
                I reported it today to Homeseer Help Center.
                Error keeps me from changing to HS4....
                Peter

                http://ohh.pcgsm.nl

                Comment


                  #23
                  Originally posted by peterpc View Post
                  I reported it today to Homeseer Help Center.
                  Error keeps me from changing to HS4....
                  Hi. Any update from HS? Thanks!

                  Comment


                    #24
                    No, still running HS3....
                    Peter

                    http://ohh.pcgsm.nl

                    Comment


                      #25
                      Greetings All,

                      I'm confused, is this not supposed to work in HS4?

                      &hs.writelog("WriteLog Entry", "Insert message here")

                      Thanks,

                      Roger D

                      Comment


                        #26
                        Originally posted by Roger D View Post
                        Greetings All,

                        I'm confused, is this not supposed to work in HS4?

                        &hs.writelog("WriteLog Entry", "Insert message here")

                        Thanks,

                        Roger D
                        Yes it is but continues to be a longstanding bug in HS4.

                        You currently have to use:

                        &nhs.writelog("WriteLog Entry", "Insert message here")

                        rjh Rich, any idea when this will be fixed?
                        Jon

                        Comment


                          #27
                          Looks like you are using vbscript. That is really old and will probably start to break going forward, change your script to .vb script and use the vb.net syntax or use the WriteLogEx function instead. I believe WriteLog has an issue because there are multiple definitions and vbscript does not support that.
                          website | buy now | support | youtube

                          Comment


                            #28
                            Originally posted by rjh View Post
                            Looks like you are using vbscript. That is really old and will probably start to break going forward, change your script to .vb script and use the vb.net syntax or use the WriteLogEx function instead. I believe WriteLog has an issue because there are multiple definitions and vbscript does not support that.
                            This is an issue with an immediate script command:

                            &hs.writelog("WriteLog Entry", "Insert message here")
                            Jon

                            Comment


                              #29
                              If we change this now we can break plugins that are using this API. So something will need to remain broken. For Immediate scripts you can use HS.WriteLogEx.

                              Originally posted by jon00 View Post

                              This is an issue with an immediate script command:

                              &hs.writelog("WriteLog Entry", "Insert message here")
                              website | buy now | support | youtube

                              Comment


                                #30
                                Originally posted by rjh View Post
                                If we change this now we can break plugins that are using this API. So something will need to remain broken. For Immediate scripts you can use HS.WriteLogEx.
                                Rich,

                                I don't wish to be a pain, but would you please elaborate on this? Which API are you referring to? If this is going to be the case, should not this be documented somewhere?

                                Just for your information, the following works in an immediate script command:

                                &nhs.Writelog ("WriteLog Entry", "Insert message here")

                                This fails:

                                &hs.Writelog ("WriteLog Entry", "Insert message here")

                                Running script(1) &hs.Writelog ("WriteLog Entry", "Insert message here"), init error: Cannot use parentheses when calling a Sub

                                As does:

                                &hs.Writelog "WriteLog Entry", "Insert message here"

                                Running script(2) &hs.writelog WriteLog Entry, Insert message here, init error: Syntax error



                                Jon

                                Comment

                                Working...
                                X