The Imports statement does work with tenScripting with a small footnote. In tenScripting, you may place multiple scripts within a single .vb file, each defined as a separate Class. For your script when it is exported to HomeSeer, any Imports statements must be defined at the front of the script file. You cannot place these Imports statements at the front of your class in tenScripting that defines your script, as they must be at the top of the .vb file, before the definition of all of the scripts (Classes) contained in the file. The simple workaround is that you place the Imports statements for ALL of the scripts defined in any of the script Classes at the beginning of the tenScripting file, and when you export a single script to HomeSeer, tenScripting copies the Import statements at the top of the file to the front of your exported script. This, however, isn't really the issue here.
The #Include statement is a relic from pre .net days, and no longer exists in VB.NET. Apparently HS does some preprocessing before compiling each script that processes the #Include statement. So, no, tenScripting does not support the #Include statement (because MS Visual Studio does not). It might be feasible for me to preprocess #Include statements in tenScripting, but I can see issues trying to debug from the source.
The .net way to reuse code is to compile the common code into a separate .dll and then add a reference to it. This is not as hard as it sounds.
If just reuse is the issue, I recommend placing all of the scripts that you intend to reference the common code into a single HS script, with multiple entry points that are called by your events just as you would call the Main sub. Each of these entry points could reference one or more Private routines in the same script. See that last code example on this page: http://tenholder.net/tenWare2/tenScr...4/Scripts.aspx
The #Include statement is a relic from pre .net days, and no longer exists in VB.NET. Apparently HS does some preprocessing before compiling each script that processes the #Include statement. So, no, tenScripting does not support the #Include statement (because MS Visual Studio does not). It might be feasible for me to preprocess #Include statements in tenScripting, but I can see issues trying to debug from the source.
The .net way to reuse code is to compile the common code into a separate .dll and then add a reference to it. This is not as hard as it sounds.
If just reuse is the issue, I recommend placing all of the scripts that you intend to reference the common code into a single HS script, with multiple entry points that are called by your events just as you would call the Main sub. Each of these entry points could reference one or more Private routines in the same script. See that last code example on this page: http://tenholder.net/tenWare2/tenScr...4/Scripts.aspx
Comment