Announcement

Collapse
No announcement yet.

Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)

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

    Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)

    Hi,

    I have written a simple Jscript:

    // JScript test
    if (hs.ison ("A1"))
    hs.execx10 ("A1","off",0)
    else
    hs.execx10 ("A1","on",0)

    The good news: It works! But: every time it runs I get the message:

    6-11-2008 22:11:58 - Info - Event Trigger "Test script ATS"
    6-11-2008 22:11:58 - Info - Running script in background: test.js
    6-11-2008 22:11:58 - Debug TI103 - SendX10: A1 Cmd: 2 Dim: 0 Data1/2: 0/0
    6-11-2008 22:11:58 - Error - Running script, script run or compile error in file: test.js0: in line 0 More info: Onbekende naam. (Uitzondering van HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))

    What's going wrong? Thanks for your help.

    Herbus, The Netherlands
    HS 2.2.066
    ACT TI203, DooNetwork
    Last edited by herbus; November 6, 2008, 05:38 PM.

    #2
    I think you need an 'End If' after the last line...
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Thanks, I have tried your suggestion.
      Unfortunately it doesn't work.

      8-11-2008 11:48:50 - Error - Running script, script run or compile error in file: test.js5009:'endif' is niet gedefinieerd in line 11 More info: 'endif' is niet gedefinieerd
      Sorry it's in Dutch. Translated it says: Endif isn't defined. Tried End if also. Here the message is:

      8-11-2008 11:49:36 - Error - Running script, script run or compile error in file: test.js1004:';' wordt verwacht in line 11 More info: ';' wordt verwacht

      Checked the microsoft msdn at http://msdn.microsoft.com/en-us/libr...hk(VS.85).aspx
      Endif or end if isn't described here. Seems that if/else doesn't need an endif.

      Any suggestions?

      Comment


        #4
        If you want to write your HomeSeer scripts using the c syntax, I suggest you try the script connector plugin.

        It supports both VB and c# scripts.
        --
        stipus

        Comment


          #5
          Does it support Jscript?
          Unfortunately I have to use Jscript. I'm preparing a script to communicate with the communication engine that's connected to my alarm panel.

          Comment


            #6
            No sorry, it doesn't support J-Script. Only VB and c#

            But usualy you can do everything that J-script does using c#. I'm not sure about your specific application though.
            --
            stipus

            Comment


              #7
              Ok, thanks.

              It should be possible to get a simple 4 lines Jscript work without errors!
              Help is very welcome to solve this problem.

              Comment


                #8
                The c syntax uses ; at the end of all statements.

                Did you try:

                // JScript test
                if (hs.ison ("A1"))
                hs.execx10 ("A1","off",0);
                else
                hs.execx10 ("A1","on",0);
                --
                stipus

                Comment


                  #9
                  Also, I'm not sure if J# is case sensitive, and if it supports optional arguments.

                  I would write:

                  // JScript test
                  if (hs.IsOn ("A1"))
                  hs.ExecX10 ("A1","off",0,0,false);
                  else
                  hs.ExecX10 ("A1","on",0,0,false);
                  --
                  stipus

                  Comment


                    #10
                    I've tried both. A1 is turned on and off just like my script.
                    But.........same error message appears.

                    Comment


                      #11
                      I love challenges... I never tried j-scripts before, but the following works fine with HS2.2.0.135

                      testjs.js
                      Code:
                      function Main( param )
                      {
                        // JScript test
                        if (hs.IsOn ("A1"))
                          hs.ExecX10 ("A1","off",0,0,false);
                        else
                          hs.ExecX10 ("A1","on",0,0,false); 
                      }
                      I got the idea to add the Main function by looking at your error code... DISP_E_UNKNOWNNAME is the COM error when a property or method is not found within an object. Also the fact that it was working fine... your code was executing as global code, and then HS tried to call Main() and it was not found.
                      Last edited by stipus; November 8, 2008, 12:15 PM.
                      --
                      stipus

                      Comment


                        #12
                        Your great! Thanks Stipus this solved the problem.
                        I'm very happy and a little dissapointed that I didn't found it myself
                        Thanks!

                        Comment

                        Working...
                        X