tenWare Software

tenScripting4 Installation

tenScripting4 consists of a single Microsoft Visual Studio solution.  You must have a recent version of Visual Studio installed to run tenScripting4.  Below are the steps necessary to get started with tenScripting4.

Installation Steps

The steps below that are in italics need only be performed once initially to set up the proper environment for tenScripting4.  They are usually not necessary to install an updated version of tenScripting4.

 

Install Visual Studio

If you do not have Visual Studio installed, go to the following web page:  https://visualstudio.microsoft.com/downloads/ and download and install the Community edition of Visual Studio 2019. There a multiple workloads that you can install within Visual Studio.  Make sure that the following is selected for install:  .NET desktop development.    This should include .NET desktop development tools, .NET Framework 4.7.2 development tools, C# and Visual Basic, and Intellisense.  If you plan on using an already installed version of Visual Studio, make sure the the 4.7.2 .NET Framework is installed and that both C# and Visual Basic are also installed.  Start Visual Studio to complete initialization.

Download and Extract tenScripting4 files

tenScripting4 is distributed as a single Zip file that contains multiple folders and files that make up a single Visual Studio solution.  This solution contains 3 VS projects:  tenScripting that contains all of the code that connects to HS4, and creates the dialogs and menus that are used to select and execute your scripts; VBscripts that will contain your scripts written in Visual Basic, and CSscripts that will contain your scripts written in C#.

Download the most current installation file using a link at  the bottom of this page.  Extract all of the files from the Zip file into a folder on your development computer, making sure that the folder hierachy is maintained. 

Depending on how your operating system security settings and/or your anit-virus program options are set, certain files downloaded from the internet may be flagged as blocked for execution because internet downloads may be unsafe.  This may generate errors when you try to load or run tenScripting4.  A later section of these instructions will detail how to unblock the necessary tenScripting4 files.

Open the tenScripting4 Solution in VS

Open Visual Studio, and then select Open Project or Solution.  Browse to the folder where you unzipped tenScripting4 and select the solution file, tenScripting4/tenScripting4.sln.  Several dialog boxes may be displayed warning you that files from the internet might be unsafe, one for each project within the solution.  Allow access for each.  These dialogs will not appear again. 

If you start execution of the solution (Green start arrow in tool bars at top of VS window), you will receive multiple errors.  There are more installation steps to complete before you can successfully run tenScripting4.

Unblock tenScripting4 files blocked by WIN Security

If you get errors indicating that one or more files cannot be run because they were downloaded from the internet (they have the mark of the web), they have to be manually unblocked.  The files marked this way are usually the .resx files.

For each blocked file, find the file in MS File Explorer, right-click on the file and then left-click properties.  A file properties dialog will open.  At the bottom of the dialog is a security message that indicates the file came from the internet.  Check the box to unblock the file.  This must be done for each blocked file.

There is a way to bulk unblock all of the blocked files.  Browse to the tenScripting4 folder that contains the tenScripting4.sln file, then click the File  Menu item, then hover over the Open Windows PowerShell sub-item, and then click Open Windows PowerShell as administrator.  Enter the following command in the command line:  dir -Recurse | Unblock-File  .  This should unblock all of the tenScripting4 files. 

Add References to HS4 Libraries

Once all of the files are unblocked, if you start the solution you will then get a series of errors indicating that multiple HS4 namespaces cannot be found.  In order to connect and access HS4 objects, tenScripting4 must have access to the HS4 libraries.  These libraries are not included in the tenScripting4 distribution because you should reference the version of the libraries that you have installed.  The three libraries that are needed are:  HomeSeerAPI.dll, Scheduler.dll, and HSCF.dll.  These are located in the root folder of your HS4 installation. 

References to these libraries need to be added to each of the three projects in the tenScripting4 solution: CSscripts, tenScripting, and VBscripts.  If you have installed tenScripting4 on a different computer than HS4, you can either copy these 3 files to a folder on your development computer, or you can use a network share to reference these files.

To add the references to a project: Open the Solution Explorer from the View/Solution Explorer menu item.  In the Solution Explorer window, you should be able to find the three projects as the top nodes of the tree.  Expand the CSscripts node, and then expand the References node.  The sub-nodes will show all of the existing library references.  To add the three HS4 libraries, right-click on References, and click on Add Reference... Click on the Browse button at the bottom of the dialog, and browse to the location of the three HS4 library files. Select the three files, and click Add and then OK.  The three libraries should now appear under the References node.  Do the same for the tenScripting and VBscripts projects.

You should now be able to successfully start the tenScripting4 solution.  You may be presented with a dialog box indicating that tenScripting4 could not connect to HS4.  If so, enter the IP address of the HS4 server, and then restart tenScripting4.

Add Code Snippets to Code Snippets Manager

Although tenScripting4 is now up and running, there is some optional functionality that still should be installed.  One is the ability to use Visual Studio Code Snippets to insert standard code, such as creating a new script, into your script code. Visual Studio maintains a system wide Code Snippet library, so you only need to add the distributed snippets to the library once.  Start VS and then open tenScripting4.  There should be two folders that contain code snippets for C# and VB under the tenScripting project.  In the Solution Explorer, expand the HS3Snippets and HS4CsSnippets folders to see the distributed snippets.  To make them available to use in your script development, they must be added to the global snippet library.  To do so, click on the Tools/Code Snippet Manager .. menu.  The Snippet Manager dialog will open.  There are separate libraries for C# and VB. Select Basic in the Language drop-down.  Then click Add and browse to the location of the HS3Snippets folder on your computer, click Select Folder. Now select Csharp as the language and add the HS4CsSnippets folder.  Click OK to close the dialog.

You can now add a snippet to your code while in the code editor by right-clicking where you want to insert the snippet and selecting Snippet/Insert Snippet.  Find the snippet you want and double-click it.

Export tenScripting4 Utility Scripts to HS4

When a HomeSeer Event is run, one of the actions is to run an existing script.  With tenScripting4, you can direct an Event to run the script in tenScripting4 so you can watch it run, and even add breakpoints to the script code for debugging.  In order to make all of this happen, a script, tenRunScript.vb, must be copied to the HS4 script folder. The easiest way to do this is to use the tenScripting4 Export function.

Start the tenScripting4 solution and click the Export Scripts menu to open the Export dialog. Before we can export a script, we must specify the location of the HS4 script folder.  Click the Specify Script Folder button, and enter the location of the script folder.  Click the Verify Access To Folder button to verify that tenScripting4 can successfully access this folder. Click Save to close the dialog.

To export the script: for File, select ExportTheseScripts.vb. Check the tenRunScript script and then click the Export Selected Scripts button.

Install tenHsEvents

tenScripting4 can interact with the tenHsEvents utility to display HS4 log entries, and to monitor HS4 Device changes.  To install tenHsEvents, go here.

 

 

Downloads

All tenScripting version numbers greater than 4.0 are for the HS4 server.  They can be downloaded below.

tenScripting4 consists of a single visual studio solution (tenScripting4) that contains three projects:  tenScripting, CSscripts, and VBscripts.  References to the following HS4 libraries must be added to ALL THREE projects:

HomeSeerAPI.dll
HSCF.dll
Scheduler.dll

 

tenScripting4 Downloads

 tenScripting 4.1  9/20/2020

Initial BETA release