Announcement

Collapse
No announcement yet.

Parameter count mismatch when invoking script

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Parameter count mismatch when invoking script

    Getting the following error:
    <TABLE border=0 cellSpacing=2 cellPadding=0 width="100%"><TBODY><TR><TD class=LOGDateTime1 noWrap align=left>2010-09-25 02:14:50 </TD><TD class=LOGType1 colSpan=3 align=left>Event </TD><TD class=LOGEntry1 colSpan=8 align=left>Running script in background: DeviceCallback_KPL.vb("SetKPLbuttons","")</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>2010-09-25 02:14:50 </TD><TD class=LOGType0 colSpan=3 align=left>Error </TD><TD class=LOGEntry0 colSpan=8 align=left>Scripting runtime error: System.Reflection.TargetParameterCountException: Parameter count mismatch. 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)</TD></TR></TBODY></TABLE>
    Function in DeviceCallback_KPL.vb declared:
    Sub SetKPLbuttons()

    Tried passing null parameter and no parameter: same error

    #2
    with vb.net scripts within HS even if you don't need to pass any values in, you need to declare at least one argument to be compatible with the HS protocol.

    change

    Sub SetKPLbuttons()

    to

    Sub SetKPLbuttons(parms as object)

    then your call should work just fine.
    Mark

    HS3 Pro 4.2.19.5
    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
    Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

    Comment


      #3
      Mark,

      Thought so as well, but then I get:
      <TABLE border=0 cellSpacing=2 cellPadding=0 width="100%"><TBODY><TR><TD class=LOGDateTime1 noWrap align=left>2010-09-25 01:56:46 </TD><TD class=LOGType1 colSpan=3 align=left>Event </TD><TD class=LOGEntry1 colSpan=8 align=left>Event Trigger "Set KPL buttons"</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>2010-09-25 01:56:46 </TD><TD class=LOGType0 colSpan=3 align=left>Event </TD><TD class=LOGEntry0 colSpan=8 align=left>Running script in background: DeviceCallback_KPL.vb("SetKPLbuttons", "")</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>2010-09-25 01:56:46 </TD><TD class=LOGType1 colSpan=3 align=left>Error </TD><TD class=LOGEntry1 colSpan=8 align=left>Script compile error: Argument not specified for parameter 'parms' of 'Public Sub SetKPLbuttons(parms As Object)'.on line 188</TD></TR></TBODY></TABLE>
      Get same error with:
      Running script in background: DeviceCallback_KPL.vb("SetKPLbuttons")

      Line 188 points to the endif of my first statement (if then else endif)

      ???

      Here's the whole function:
      Sub
      SetKPLbuttons(ByVal parms AsObject)
      If hs.isoff("\8") And hs.isoff("\9") And hs.isoff("\10") And hs.isoff("\11") And hs.isoff("\29") And hs.isoff("\36") Then
      hs.execx10(KPL_A, "Off") ' all are off, turn off the kpl btn
      Else
      hs.execx10(KPL_A, "On") ' at least one is On, so turn on the kpl btn
      EndIf
      If hs.isoff("\3") And hs.isoff("\4") And hs.isoff("\5") And hs.isoff("\6") And hs.isoff("\7") And hs.isoff("\12") And hs.isoff("\13") And hs.isoff("\15") And hs.isoff("\39") Then
      hs.execx10(KPL_B, "Off") ' all are off, turn off the kpl btn
      Else
      hs.execx10(KPL_B, "On") ' at least one is On, so turn on the kpl btn
      EndIf
      If hs.isoff("\17") And hs.isoff("\20") And hs.isoff("\27") And hs.isoff("\30") And hs.isoff("\32") Then
      hs.execx10(KPL_C, "Off") ' all are off, turn off the kpl btn
      Else
      hs.execx10(KPL_C, "On") ' at least one is On, so turn on the kpl btn
      EndIf
      If hs.isoff("\1") And hs.isoff("\2") And hs.isoff("\21") And hs.isoff("\38") And hs.isoff("\40") And hs.isoff("\41") Then
      hs.execx10(KPL_D, "Off") ' all are off, turn off the kpl btn
      Else
      hs.execx10(KPL_D, "On") ' at least one is On, so turn on the kpl btn
      EndIf
      End
      Sub

      Comment


        #4
        hs adds about 12/13 lines to the beginning of your code when it gets run, so the real line from your code is 188-12/13. can you attach the entire .vb file
        Mark

        HS3 Pro 4.2.19.5
        Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway | Tuya Smart Plugs
        Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 | Ultra1Wire3 | RFXCOM | HS MyQ | BLRadar | BLDenon | Tuya | Jon00 Charting | Jon00 Links
        Platform: Windows Server 2022 Standard, i5-12600K/3.7GHz/10 core, 16GB RAM, 500GB SSD

        Comment


          #5
          Mark,

          Thanks! Your comments about HS adding 12-13 lines made me click that this sub, called by an HS event, is also called within the VB routine by another sub. When I added a null parameter to that other calling sub, all went OK.

          Comment

          Working...
          X