Announcement

Collapse
No announcement yet.

HS-247 - Immediate Scripts do not work

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

  • integlikewhoa
    replied
    Originally posted by Wadenut View Post
    In your case,
    &hs.SetDeviceValueByRef(279,hs.DeviceValueEX(293),True)
    should do it for the immediate script. Be aware though, this will create a new script file in your Temp directory.
    Thanks that worked.

    Leave a comment:


  • Wadenut
    replied
    In your case,
    &hs.SetDeviceValueByRef(279,hs.DeviceValueEX(293),True)
    should do it for the immediate script. Be aware though, this will create a new script file in your Temp directory.

    Leave a comment:


  • integlikewhoa
    replied
    After converting to HS4 i'm having all my &hs scripts failing and filling the logs. Water meter tracking and few other things I would mirror the devices using something like this.

    &hs.SetDeviceValueByRef 279,hs.DeviceValueEX(293),True

    But that now throws an error.

    What would be the correct way of convetering that to &nhs? Just adding the "n" throws other errors below.

    Compiling script C:\Program Files (x86)\HomeSeer HS3\Temp\K2.vb: End of statement expected.

    Compiling script C:\Program Files (x86)\HomeSeer HS3\Temp\K2.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

    Leave a comment:


  • Wadenut
    replied
    All well and good, but if one isn't interested in creating a script file, then no go.

    Leave a comment:


  • jon00
    replied
    Originally posted by Wadenut View Post
    Interesting. The 'n' stands for? This is a significant difference.
    Actually nhs is also available in Homeseer 3. &nhs only works for immediate script commands and tells Homeseer to create a temporary VB.NET script where its function returns the result. The normal &hs. method goes back to VB Script days. I'm not sure but it may have been added for Linux users where VB.Script is not supported.

    Providing you start with a homeseer scripting command, you can actually run very small scripts from a single line.

    Example:
    Code:
    &nhs.version: For p as integer=1 to 10: hs.writelog("Count",p): Next
    (The nhs.version does nothing but tells HS to create the script.)

    You will find the temporary scripts created in your <Homeseer root>\Temp directory and labeled KX.vb (where X is a number)

    The script created for the example is shown below.

    Code:
    Function Main(parm as object)
    dim result as object
    result=hs.version: For p as integer=1 to 10: hs.writelog("Count",p): Next
    return(result)
    End Function

    Leave a comment:


  • Wadenut
    replied
    Interesting. The 'n' stands for? This is a significant difference.

    Leave a comment:


  • jon00
    replied
    Originally posted by Wadenut View Post
    18/12/2019 8:11:31 AM HomeSeer System Control Panel Immediate Script: &hs.writelog("TEST",hs.version)
    18/12/2019 8:11:31 AM HomeSeer Error Running script(1) &hs.writelog("TEST",hs.version), init error: Cannot use parentheses when calling a Sub
    18/12/2019 8:12:13 AM HomeSeer System Control Panel Immediate Script: &hs.writelog "TEST",hs.version
    18/12/2019 8:12:13 AM HomeSeer Error Running script(2) &hs.writelog "TEST",hs.version, init error: Syntax error




    1
    It does however work if you use:

    &nhs.writelog("TEST",hs.version)

    Leave a comment:


  • Wadenut
    started a topic HS-247 - Immediate Scripts do not work

    HS-247 - Immediate Scripts do not work

    18/12/2019 8:11:31 AM HomeSeer System Control Panel Immediate Script: &hs.writelog("TEST",hs.version)
    18/12/2019 8:11:31 AM HomeSeer Error Running script(1) &hs.writelog("TEST",hs.version), init error: Cannot use parentheses when calling a Sub
    18/12/2019 8:12:13 AM HomeSeer System Control Panel Immediate Script: &hs.writelog "TEST",hs.version
    18/12/2019 8:12:13 AM HomeSeer Error Running script(2) &hs.writelog "TEST",hs.version, init error: Syntax error




    1
Working...
X