Announcement

Collapse
No announcement yet.

Has anyone gotten ScriptingReferences to work properly?

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

    Has anyone gotten ScriptingReferences to work properly?

    I'm trying to include external libraries for use by my scripts but I cannot get it to work. The closest I got was an error log message that said the DLL could not be found, but I can't even get that message to appear anymore.

    I'm using the latest beta. Does anyone have a sample settings.INI and script that uses an external DLL that is known to work and would be willing to share? Thanks.
    Last edited by tgpaul; January 12, 2015, 03:01 PM.

    #2
    ScriptingReferences=DDay.iCal;DDay.iCal.dll,DDay.Collections ;DDay.Collections.dll,antlr.runtime;antlr.runtime.dll

    is what I call when referring to the iCal library I use to download Google Calendar data. All of the respective DLL files are in the HS directory.

    Comment


      #3
      Originally posted by mrhappy View Post
      ScriptingReferences=DDay.iCal;DDay.iCal.dll,DDay.Collections ;DDay.Collections.dll,antlr.runtime;antlr.runtime.dll

      is what I call when referring to the iCal library I use to download Google Calendar data. All of the respective DLL files are in the HS directory.
      I forgot to mention that I'm using C# scripts. @MrHappy, by any chance are you using C#?

      I've gotten everything to work when using a VB.NET startup script. Other C# scripts can access external libraries.

      I'm fairly certain this is a bug. I'm going to write a Bugzilla report, but it would be useful if someone else could corroborate this behavior.

      Comment


        #4
        Bug 2538 written:
        http://bugzilla.homeseer.com/bugzill...ug.cgi?id=2538

        Comment


          #5
          Updated the bug:

          The ScriptingReferences INI entry is for vb.net only.

          We use csscript for C# scripting, to add a reference to a dll add this to your C# file:

          //css_reference Microsoft.VisualBasic.dll;

          Note that you need the entire string even though it looks like its commented out.
          πŸ’‍♂️ Support & Customer Service πŸ™‹‍♂️ Sales Questions πŸ›’ Shop HomeSeer Products

          Comment


            #6
            I know I'm a little late to this thread but where should custom dll's be placed on a UNIX machine to be accessed by a C# script? the bin directory? the script directory? Additionally, would i need a call such as below in my script file?
            <DllImport("MyDll.dll")> Public Shared Function DLL_Function() As Boolean

            Comment


              #7
              If its just a dll for your own use, put in the HS3 dir, HS3 and scripts will always look there. If you are developing a plugin, they should go in bin/plugin_name, and a exe.config file should be included that supplies the path to your DLL files.

              Originally posted by flatbush97 View Post
              I know I'm a little late to this thread but where should custom dll's be placed on a UNIX machine to be accessed by a C# script? the bin directory? the script directory? Additionally, would i need a call such as below in my script file?
              <DllImport("MyDll.dll")> Public Shared Function DLL_Function() As Boolean
              πŸ’‍♂️ Support & Customer Service πŸ™‹‍♂️ Sales Questions πŸ›’ Shop HomeSeer Products

              Comment


                #8
                Thanks for the quick response. Will I need to import the dll in my script to this dll if placed in the HomeSeer directory? If I am using C# do i need to add a reference in the ini file?

                Comment


                  #9
                  I have not messed with other DLL files, but try it first with just a "Using" statement in your script. If that does not work, then try adding it to the script references in the INI file.

                  Originally posted by flatbush97 View Post
                  Thanks for the quick response. Will I need to import the dll in my script to this dll if placed in the HomeSeer directory? If I am using C# do i need to add a reference in the ini file?
                  πŸ’‍♂️ Support & Customer Service πŸ™‹‍♂️ Sales Questions πŸ›’ Shop HomeSeer Products

                  Comment


                    #10
                    I'm getting crazy trying to use an own DLL developed using Visual Studio 2015, running ok in Windows 7, trying to be used in C# under Mono in my ZEE S2.
                    I used 2 methods, one the described here, using css_reference and the clause "using", and the other using DllImport and public static extern to reference the function to call.
                    In the first case the error is that namespace is not found, although there is in the HomeSeer directory, and using the DllImport the error is System.DllNotFoundException at execution time (at least it compiled). I added the DLL to the GAC as well.
                    It's totally frustrating. I've been googling and I tried different methods without any success.

                    Any ideas?, suggestions?

                    Comment


                      #11
                      re: //css_reference Microsoft.VisualBasic.dll;

                      what file do i place that into?

                      Comment


                        #12
                        You place it in the c sharp script file. Rich mentioned earlier that HomeSeer is using the cs-script engine (Releases Β· oleg-shilo/cs-script Β· GitHub), looking at my HS3 it appears this is 3.7.2.0 the documentation wiki for that site should provide examples like this one Using .NET assemblies (cs-script.net)
                        Just be careful that the example pertains to the version HomeSeer is running.

                        Comment


                          #13
                          please see my thread here: https://forums.homeseer.com/forum/de...eric-not-found

                          I cant get the C# script to compile. The List cant be resolved..

                          Comment

                          Working...
                          X