Visual Studio Code Snippets
Visual Studio provides the capability to build libraries of frequently used programming code called Code Snippets, that can be easily inserted into your code.
tenScripting provides a set of Code Snippets for writing HomeSeer scripts. There are separate libraries for Visual Basic and C#.
An example is the snippet that generates all of the code for the definition of a new HS script, including: the definition of a new Class; the definition of the SUB Main; and the generation of code to split out multiple items from the single String parameter. One of the most frequent issues tenScripting users have, is when they fail to properly define the SUB Main statement so that tenScripting and HS can properly identify it. By using the Code Snippet, all of this is done with just a few key-strokes. For a C# script, it also generates the statements that instantiates the hs object.
For a VB script, in the code editor, place the cursor at the end of a script file, and right-click on a new line, left-click Snippet, and then Insert Snippet. The following menu will appear:
Double-click HsVbSnippets then double-click New Script. The following will be inserted:
The cursor will be placed at the new Class Name for you to enter the name of your new script.
The process is similar if you are creating a script in the CSscripts project. Select the HS4 New Script snippet from the HsCsSnippets library to insert the following: