Announcement

Collapse
No announcement yet.

hs.SaveVar / hs.GetVar Broken in 2.1.100

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

    hs.SaveVar / hs.GetVar Broken in 2.1.100

    UPDATE -- I overlooked that I needed to use a hs.CreateVar before the SaveVar. The funny thing is this code is exactly the same as it was running in 2.0.41, but for some reason I never got an error about it. Thanks to HS support for their fast response to my ticket.

    Just wanted to give everyone a heads up on a ticket I just opened. After upgrading to 2.1.100, some of my scripts broke. Specifically when using hs.SaveVar and hs.GetVar functions. Here is a copy of the ticket I submitted:

    I have scripts which use the hs.SaveVar / hs.GetVar functions. After upgrading to 2.1.100 (from 2.0.41 I think), these functions do not operate as intended. Specificially, they break when using hs.SaveVar to point to an object reference.

    Here is an example.

    Using the following script:

    PHP Code:
        dim mediaAOLRadioStationNames as New ArrayList() 
           
          
    mediaAOLRadioStationNames.Add("XM The Blend"
          
    mediaAOLRadioStationNames.Add("AOL Pop Remixes"
          
    mediaAOLRadioStationNames.Add("XM BPM"
          
    mediaAOLRadioStationNames.Add("XM Chill"
           
          
    dim i 
           
          
    for 0 to mediaAOLRadioStationNames.count 
           
              hs
    .writelog("test"mediaAOLRadioStationNames(i)) 
           
          
    next 


    I get the following in the hs.log:

    6/30/2006 10:01:44 AM test XM The Blend
    6/30/2006 10:01:44 AM test AOL Pop Remixes
    6/30/2006 10:01:44 AM test XM BPM
    6/30/2006 10:01:44 AM test XM Chill
    However, when using hs.SaveVar to place this array in a HomeSeer variable with the following test script:

    PHP Code:
        dim mediaAOLRadioStationNames as New ArrayList() 
           
          
    mediaAOLRadioStationNames.Add("XM The Blend"
          
    mediaAOLRadioStationNames.Add("AOL Pop Remixes"
          
    mediaAOLRadioStationNames.Add("XM BPM"
          
    mediaAOLRadioStationNames.Add("XM Chill"
           
          
    hs.DeleteVar("mediaAOLRadioStationNames"
       
          
    hs.SaveVar("mediaAOLRadioStationNames"mediaAOLRadioStationNames
       
          
    dim testVar 
           
          testVar 
    hs.GetVar("mediaAOLRadioStationNames"
           
          
    dim i 
           
          
    for 0 to testVar.count 
           
              hs
    .writelog("test"testVar(i)) 
           
          
    next 


    I get the following error in the HS log:

    Scripting runtime error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMemberException: Public member 'count' on type 'String' not found. at Microsoft.VisualBasic.CompilerServices.Symbols.Container.Get Members(String& MemberName, Boolean ReportErrors) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGe t(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) at scriptcode17.scriptcode17.test(Object dummy) --- 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)


    This same script worked perfectly in previous HS 2.x versions.
    Last edited by TreeFrog; July 7, 2006, 02:26 PM.
Working...
X