| Script & Plug-In Development Discuss scripting for HomeSeer and general VBScript assistance. Use this forum to post incomplete scripts, script snippets or code samples. |

November 6th, 2008, 05:27 PM
|
|
Seer
|
|
Join Date: Sep 2005
Location: The Netherlands
Posts: 71
|
|
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 6th, 2008 at 05:38 PM.
|

November 6th, 2008, 05:58 PM
|
 |
OverSeer
|
|
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 3,460
|
|
I think you need an 'End If' after the last line...
__________________
GearHouse Club Member
FoxConn D525 Atom 1.8Ghz / Win7 32 / 4G RAM /
HSPRO v2.5.0.78 / 2 Z-Trollers / 50 Z-Wave devices
WGL800 / RFXCOM / OS Sensors / X10 Motion Sensors / DS10a / Schlage Lock / Way2Call
|

November 8th, 2008, 06:02 AM
|
|
Seer
|
|
Join Date: Sep 2005
Location: The Netherlands
Posts: 71
|
|
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?
|

November 8th, 2008, 06:34 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 4,183
|
|
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.
|

November 8th, 2008, 06:41 AM
|
|
Seer
|
|
Join Date: Sep 2005
Location: The Netherlands
Posts: 71
|
|
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.
|

November 8th, 2008, 06:44 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 4,183
|
|
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.
|

November 8th, 2008, 07:00 AM
|
|
Seer
|
|
Join Date: Sep 2005
Location: The Netherlands
Posts: 71
|
|
Ok, thanks.
It should be possible to get a simple 4 lines Jscript work without errors! 
Help is very welcome to solve this problem.
|

November 8th, 2008, 07:08 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 4,183
|
|
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);
|

November 8th, 2008, 07:11 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 4,183
|
|
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);
|

November 8th, 2008, 11:22 AM
|
|
Seer
|
|
Join Date: Sep 2005
Location: The Netherlands
Posts: 71
|
|
I've tried both. A1 is turned on and off just like my script.
But.........same error message appears.
|

November 8th, 2008, 12:03 PM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 4,183
|
|
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 8th, 2008 at 12:15 PM.
|

November 9th, 2008, 08:04 AM
|
|
Seer
|
|
Join Date: Sep 2005
Location: The Netherlands
Posts: 71
|
|
Your great! Thanks Stipus this solved the problem.
I'm very happy   and a little dissapointed that I didn't found it myself 
Thanks!
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
All times are GMT -4. The time now is 12:47 PM.
|