Announcement

Collapse
No announcement yet.

VB.NET scripting...

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

  • VB.NET scripting...

    Should I be migrating all of my scripts to VB.NET scripting? Where is the best place to get the syntax or do I need to purchase VB.NET to compile? Also, is Microsoft's JScript the same as VB.NET script?
    Last edited by Near76; February 17th, 2006, 04:13 PM.

  • #2
    I moved all my scripts over. There is no compiler needed, just a text editor. The .NET scripts are nearly 20x faster on my machine than the VBScript scripts. The initial changes can be pretty minor but to get the real power of it you define your variables as specific class types and then use the class functions. This is where most of the speed improvements come from. Plus you get the whole .NET libraries to work with which contain an astonishing amount of power.

    The only downside is that each version of the script that is run takes a .NET thread, thus if you do a few hundred edits to a script you would want to restart HS.

    Microsoft has a ton of .NET information on-line and there are good books about it too.

    Jon



    Originally posted by Near76
    Should I be migrating all of my scripts to VB.NET scripting? Where is the best place to get the syntax or do I need to purchase VB.NET to compile? Also, is Microsoft's JScript the same as VB.NET script?
    Jon Ort
    JonOrt@The--Orts.com
    (Remove the dashes in the address, spam is getting out of hand)

    Comment


    • #3
      Thanks for the info!

      Comment


      • #4
        Thanks for the info Oman.

        Do you know if there a way to lock down a thread so it has exclusive priority in .NET. I have some scripts that change voices & then speak. I can't use these because they hose my speaker app. I believe the problem happens when one script is changing the voice while another script is trying to speak.

        Comment


        • #5
          Originally posted by cactsbob
          Thanks for the info Oman.

          Do you know if there a way to lock down a thread so it has exclusive priority in .NET. I have some scripts that change voices & then speak. I can't use these because they hose my speaker app. I believe the problem happens when one script is changing the voice while another script is trying to speak.
          Which voices are you using? You could switch them in line using XML calls if your using the NEO or AT&T voices.
          -Rupp
          sigpic

          Comment


          • #6
            Would someone mind posting a basic VB.NET script for homeseer 2. All of the VB.NET books I looked at are more geared to creating complete Windows applications. I have the FCS class reference...which I think is most of what I need.

            Comment


            • #7
              They look like VB, they are VB. Just VB.NET. Most simple scripts will look pretty much the same. With VB.NET you get multiple ways to do things. For instance the typical way to convert a number variable to a string is to use "Str(NumVar)" but with VB.NET you can also use "NumVar.ToString()". Everything in VB.NET is actually a class. There are a few syntax differences (which have been a long time coming), like the fact that VB.NET wants you to put all parameters for subs and functions in brackets (thank you Microsoft). The format for the Main function of a script is a bit different and the extension is different.


              Sub PageAllRooms(ByVal parm1 As Object)

              If hs.IsOn("z15") = True ' See if the "Allow paging" device is on
              'Use the BK page event
              ActivateBKPage(1)

              hs.waitsecs(1)
              hs.Speak(parm1, True)
              hs.waitsecs(1)

              'Restore normal zone operation
              ActivateBKPage(0)
              Else
              hs.WriteLog ("Paging", "All house paging not allowed due to z15 paging device being in off state:" & parm1)
              End If

              End Sub

              Sub PageLimitedRooms(ByVal parm1 As Object)

              'Use the BK page event
              ActivateBKPage(2)

              hs.waitsecs(1)
              hs.Speak(parm1, True)
              hs.waitsecs(1)

              'Restore normal zone operation
              ActivateBKPage(0)
              End Sub

              Sub ActivateBKPage(Mode as Integer)
              hs.WriteLog ("BKPaging", "Setting BK Page/Event mode" & Str(Mode))
              hs.plugin("BKCT600").SetPagingMode(Mode)
              End Sub




              Originally posted by Near76
              Would someone mind posting a basic VB.NET script for homeseer 2. All of the VB.NET books I looked at are more geared to creating complete Windows applications. I have the FCS class reference...which I think is most of what I need.
              Jon Ort
              JonOrt@The--Orts.com
              (Remove the dashes in the address, spam is getting out of hand)

              Comment


              • #8
                Thanks! Sounds like a good VB.NET class reference book is all I need.

                Comment

                Working...
                X