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.  

(0) 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 with .NET 2022. There are multiple workloads that you can install within Visual Studio.  Make sure that the following is selected for install:  .NET desktop development, including .NET Framework 4.6.2-4.7.1 development tools.    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.

(1) 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 4 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,  CSscripts that will contain your scripts written in C#, and tenGlobalMethods that will contain global methods that you create that can be called in ANY HS4 scripts.

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.

(2) 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.

(3) 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. Use MS File Explorer to 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. 

(4) Add References to HS4 Libraries

Beginning with the version 4.5 distribution, the current HS4 libraries are included in the zip file, and each of the four projects in tenScripting4 have defined references to these .dll (library) files.  You should now be able to start tenScripting4 without errors.  If you get errors that one or more of the HS4 libraries cannot be loaded or various HS4 methods are not defined, then the version of HS4 that you are running may have incompatible library files with the current ones included with the tenScripting4 distribution.  If you experience this situation, please see TIP 01 for a simple resolution.

(5) 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 the tenScripting4 solution. There should be two folders that contain code snippets for C# and VB under the tenScripting project.  In the Solution Explorer, expand the HsVbSnippets and HsCsSnippets 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 HsVbSnippets folder on your computer, click Select Folder. Now select Csharp as the language and add the HsCsSnippets 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. 

(6) 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 to export all of the tenScripting4 Utility Scripts.

Start the tenScripting4 solution and click the Export Scripts menu to open the Export dialog. Before you can export a script, you 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 scripts: for File, select ExportTheseScripts.vb. Check all of the scripts in the list and then click the Export Selected Scripts button.

(7) 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.

(8) Optionally, install Global Methods

If you want to use the Scripting Extensions included in the tenScripting4 distribution, or write your own shared scripting methods, then you need to review this page.  You need to copy the dll file and add the reference to HS4.

   

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 four projects:  tenScripting, CSscripts, VBscripts, and tenGlobalMethods. All of the folders and files that make up the tenScripting4 solution are included in a single zip file that can be download below.

  If you are upgrading from a prior tenScripting4 release, review Upgrading tenScripting4

tenScripting4 Downloads

 tenScripting 4.2201  8/19/2024

All \obj folders removed from distribution

No functionality changes

 tenScripting 4.2200  7/11/2024

Includes HS 4.2.20.0 libraries

Updated tenGlobalMethods to 4.2193

     Significant enhancements 

HS3 documentation website moved

Downgraded C# compiler to version 3.0 language specification to match HS4

 tenScripting 4.2190  12/11/2023

Includes HS 4.2.19 libraries

Enhanced shutdown logic

tenGlobalMethods version 4.218 included

Help links have been updated

Additional error checking

Removed links to deprecated tenHsEvents. Use tenScriptAid.

 tenScripting 4.218  3/12/2023

Includes HS 4.2.18 libraries

tenGlobalMethods.GetFeatureRefByFullname Updated

         Copy tenGlobalMethods.dll to the HS4 root folder (see step 8 above) 

All tenWare links are now HTTPS

 tenScripting 4.16  1/20/2023

Includes HS 4.2.16 libraries

Updated logos

 tenScripting 4.12  4/14/2022

Includes HS 4.2.11 libraries

Fixed tenGlobalMethods.GetFeatureByFullname bug

         Copy tenGlobalMethods.dll to the HS4 root folder (see step 8 above) 

 tenScripting 4.11  1/10/2022

Includes HS 4.2.7 libraries

Increased allowed difference in file timestamps for exported files

Fixed handling of version information for HS 4.2.x

 tenScripting 4.10  3/27/2021

Save selected File/Script/Method for next execution

Added tenRunScriptButton Utility Script (see TIP 03)

Additional debugging

 tenScripting 4.8  3/2/2021

Added warning to copy tenGlobalMethods.dll to HS4 folder if the reference is added to ScriptingReferences

 tenScripting 4.7  3/1/2021

HS4 version 4.1.14.0 has been released that now provides an hs4 object of class IHsController. If you have updated to this release, tenScripting4 will no longer replace hs4 with hsRead this.

HS4 version 4.1.14.0 now provides a reference to PluginSDK, eliminating the need to update ScriptingReferences= in settings.ini. tenScripting dialogs have been updated appropriately.

tenGlobalMethods GetRefsByCategoryName and GetCategoriesByRef have been updated to handle when a Category contains a reference to a missing device. Copy tenGlobalMethods.dll to your HS4 folder. (see step 8 above)

4.7 distribution includes HS Version 4.1.14.0 libraries

 tenScripting 4.6  2/13/2021

Included System.Data.SQLite.dll in distribution package

Added button to add System.Data.SQLite.dll to HS4 ScriptingReferences

4.6 distribution includes HS Version 4.1.12.0 libraries

 tenScripting 4.5  2/5/2021

New facility to code, test, and deploy HS Global Methods

The Parms checkbox has been replaced with a dropdown control

Eliminated Registration Failed message in the HS Log

Some items moved from the Help menu to the Tools menu

Replaced the tenScriptAid button with an Open HS Log button

Updated the VB New Script snippet. Remove old snippets and add the ones in this version per the instructions above on this page.

Changed HS DLL references to tenScripting4\Libraries

Eliminated Nuget dependencies

 tenScripting 4.4  1/27/2021

No longer remove commas from script parameters for HS scripts

Removed Debug Log processing

Fix bug with improper registering as HS4 plugin, resulting in tenRunScript failures
You must re-export tenRunScript, see (6) above.

Reorganized Menus

 tenScripting 4.3c  1/14/2021

The Export function now changes all hs4. references to hs. instead of inserting Dim hs4 as object = hs

Enhanced logging

If when running a script you de-select Process as HS Parameters, a reminder is shown to use commas as separaters.

Changes to Snippets. Remove old snippets and add the ones in this version per the instructions above on this page.

 tenScripting 4.2  12/14/2020

Fixed dialog references to HS3

Turned on Option Implicit and Option Strict

Included compiled files with distribution to lesson confusion

Fixed Add ScriptingReference bug

 tenScripting 4.1  9/20/2020

Initial BETA release