No announcement yet.

How to expose plugin sub

  • Filter
  • Time
  • Show
Clear All
new posts

    How to expose plugin sub

    I am very new to plugins. Was forced to write a plugin when migrating from HS3->HS4 as my (Spotify) script could no longer run.

    I have proceeded by modifying the SamplePlugin and in particular WriteLogSampleActionType.vb
    The entered log message is passed on like a parameter to my scripts.

    Instead of executing my sub through an event, I would like to call it through an ordinary script.
    My understanding is that the syntax would be something like:
    hs.PluginFunction("PluginName", "", "MySpotifyStart", "parms")

    How do I expose the "MySpotifyStart()" sub? It is located in WriteLogSampleActionType.vb.

    Any pointers would be very valuable!

    - defined the "MySpotifyStart()" sub in WriteLogSampleActionType.vb as "Shared"
    - created a new sub in HSPI.vb that calls the sub above. Only HSPI subs can be exposed (?).

    Not very pretty, but it works.
    Plenty of warnings like remain:
    "Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated."