Announcement

Collapse
No announcement yet.

Caling a plugin in VB

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

  • Caling a plugin in VB

    Hi,
    I am trying to convert a scrit accessing a plugin from basic (.txt) to VB (.vb)

    the original working script ( .txt) is :
    sub main
    with hs.plugin("mcsXap")
    .SendXapMessage "test.rest.test", "BSC.Message", "Fonction", "Valeur" & Chr(1) & "Value"
    End With
    [font=Calibri]end sub

    the vb version :
    Sub Main()
    Dim xap as object
    xap = hs.GetPluginsEX("mcsXap")
    with xap
    .SendXapMessage("test.rest.test", "BSC.Message", "Fonction", "Valeur" & Chr(1) & "Value")

    End With

    End Sub

    and i get the following :
    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)

    Does anyone have a idea why ?

  • #2
    Not sure if thats a direct copy for your vb.net script...if so you will need to specify a parameter so try changing

    Sub Main()

    To

    Sub Main(ByVal Parms As Object)

    It may explain the parameter count error message, I use hs.plugin("My Plugin") myself rather than getpluginex - i'm not sure if this will also give you a problem, so try

    Sub Main(ByVal Parms As Object)
    Dim xap as object
    xap = hs.Plugin("mcsXap")
    xap.SendXapMessage("test.rest.test", "BSC.Message", "Fonction", "Valeur" & Chr(1) & "Value")
    End Sub

    Its probably not worth using a with/end with function if your only sending one command either but its not a massive problem
    My Plugins:

    Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
    Yeelight 3P | Nanoleaf 3P

    Comment


    • #3
      thanks a lot.
      it is working all right.

      Claude

      Comment

      Working...
      X