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?
Announcement
Collapse
No announcement yet.
VB.NET scripting...
Collapse
X
-
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 Near76Should 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)
-
Near76
-
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
-
Originally posted by cactsbobThanks 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.-Rupp
sigpic
Comment
-
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.
Comment
-
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 Near76Would 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
-
Near76
Comment