Announcement

Collapse
No announcement yet.

linking scripts together

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

    linking scripts together

    Hi

    I was wondering if it is possible to link script files together? I have several script files that deal with different aspects but some share common functionality eg I have a function that writes back to an sql database and I need that in several script files. at the moment I have the same function copied in the different scripts but it would be great if I could just have it one place and reference t

    is this possible somehow?

    #2
    Sure, use the hs.runscriptfunc command i.e.

    'one of your scripts
    Dim Result As String = hs.runscriptfunc("Database.vb","mydatabasefunc","<send something to your function here>",True, False)

    ------- Database.vb------
    Function mydatabasefunc(ByVal Data As String) As String
    ' Your code
    Return <whatever>
    End Function
    -------------------------
    Jon

    Comment


      #3
      of course! thanks for that I was trying to approach it from the wrong angle lol

      Comment


        #4
        You should also consider combining these scripts into a single script with multiple functions (instead of 'Main'). Include the common code as a SUB within the script and call it from each of your functions. You can have an event call each entry point as appropriate. Makes understanding and maintenance of the script (was scripts) easier.

        tenholde
        tenholde

        Comment


          #5
          Hi. Yes I already do that. The trouble is I have say 30 different functions for controlling my av receiver in one script then ihave all the capi functions setup then all of my db functions. I wanted the ability to cross call them. Thanks

          Comment


            #6
            linking scripts together

            You could put common code into a single file and include that in any script that uses it by referencing that file. That method or approach worked back to HS1
            huggy_d1

            Automating made easy

            Comment


              #7
              That was kind of what I was thinking to start with. Could you provide an example of how that would work? Eg code example

              Comment

              Working...
              X