| Script & Plug-In Development Discuss scripting for HomeSeer and general VBScript assistance. Use this forum to post incomplete scripts, script snippets or code samples. |

November 16th, 2009, 07:23 AM
|
|
Viewer
|
|
Join Date: Nov 2009
Location: Norway, Bergen
Posts: 2
|
|
Learn to create script:
Where can I find the overview of the whole script language (.Txt file) to homesser?
I need to learn it.
What is the syntax to check whether the clock greater than 13?
|

November 16th, 2009, 07:35 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 3,715
|
|
You should not use the .txt file syntax anymore. You'd better use the new .vb file syntax.
For this new VB.NET syntax, there are many sites with tutorials.
Just google for VB.NET tutorial or VB.NET reference
|

November 16th, 2009, 07:36 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 3,715
|
|
If DateTime.Now.Hour > 13 Then ... End If
[EDIT] fixed a typo...
Last edited by stipus; November 18th, 2009 at 01:09 PM.
|

November 16th, 2009, 07:51 AM
|
 |
Seer Master
|
|
Join Date: Aug 2007
Location: Norway
Posts: 835
|
|
Se også her:
http://www.homeseer.com/support/home...2/homeseer.htm
Many years ago I read a "Teach yourself VB.net in 21 days" book. It was very good to explain the basics. The rest is just logic.
__________________
HSPro 2.4, RFXcom, Script Connector, BT connector, DI Connector, DooNetwork, HSTouch, WMP plugin, USB-UIRT, BLicon, DenonAVR, WebcamXP, Jon00s MaxiBee and Webpage builder
|

November 16th, 2009, 09:25 AM
|
 |
OverSeer
|
|
Join Date: Jan 2001
Location: Huntsville, Al. USA
Posts: 33,801
|
|
I disagree with Stipus, the vb script syntax is much easier to learn for beginners and both still work just fine. The best way to learn is go to the script library and look at existing scripts. The HomeSeer help files also have many examples for each scripting command as well.
__________________
-Rupp
Last edited by Rupp; November 16th, 2009 at 10:42 AM.
|

November 16th, 2009, 09:48 AM
|
|
OverSeer
|
|
Join Date: Aug 2003
Location: FRANCE
Posts: 3,715
|
|
One day you'll learn how to spell my name
You might be right, however the old syntax is just a language from the past.
Learning VB.Net might be usefull for many other systems...
|

November 16th, 2009, 10:07 AM
|
 |
Seer Master
|
|
Join Date: Aug 2007
Location: Norway
Posts: 835
|
|
Quote:
Originally Posted by Rupp
I disagree with Stupis, the vb script syntax is much easier to learn for beginners and both still work just fine.
|
The VB script syntax is outdated and should have been removed from HomeSeer a long time ago. In my opinion it's also harder to learn as it's not as logical as .NET is.
Go the .NET route, you won't regret it.
__________________
HSPro 2.4, RFXcom, Script Connector, BT connector, DI Connector, DooNetwork, HSTouch, WMP plugin, USB-UIRT, BLicon, DenonAVR, WebcamXP, Jon00s MaxiBee and Webpage builder
|

November 16th, 2009, 10:12 AM
|
 |
Super Seer
|
|
Join Date: Feb 2006
Location: Rochester, NY
Posts: 1,506
|
|
Quote:
|
...the old syntax is just a language from the past.
|
I am torn by this statement. While true from the standpoint that it makes effective use of current OS capabilities, vb.net design is definitely not forward looking. As far as I can tell, it was munged together by a bunch of drunk C# programmers with no one having overall project design responsibility. Worse, they don't appear to have talked to one another, or at least couldn't decide on a common set of conventions for object class specifications. Worst, they turned the task of crafting error messages over to a robot with no prior experience!
From a usability and learning point of view, VBS is far superior. It is internally self consistent. It's documentation is comprehensive, and reasonably easy to understand. The language is inherently (by design!) quite forgiving, and when you make an error, it is usually helpful in identifying the problem and suggesting an appropriate solution.
If you plan to go anywhere with Visual Basic, you owe it to yourself to learn to use vb.net. If you are just starting out learning how to write a script. Your frustration level will be much lower if you begin with VBS.
__________________
Mike
____________________________________________________________ __________________
HS 2.3.0.19 || Stargate 2.2 | ACRF2 1.0.3226.27426 | VWSCSV 2.2 | Ultrastatus 1.1.3172.37875 | BLRFID 1.0.35.0 | PowerTrigger 1.3 | NetCam 1.1 | ActiveBackup 2.0.0.26 || Scripts: Weather XML | PerfMon | VDGraph || HW: EeeBox | JDS Stargate | NetworX NX-8E | CAV6.6 w ABUS | Slink-e / CDJ | Compose switches, keypads, firewalls | WGL800 | RFXCOM LAN2 | LaCrosse 2310
|

November 16th, 2009, 10:41 AM
|
 |
Seer Master
|
|
Join Date: Aug 2007
Location: Norway
Posts: 835
|
|
Quote:
Originally Posted by Uncle Michael
Your frustration level will be much lower if you begin with VBS.
|
I disagree.
I started with VBA and VBS around the time when .NET Framework version 1.0 came along. I was thrilled with the switch to .NET. Finally some structure and logic!
But... we can't all like the same things. And thankfully we don't.
__________________
HSPro 2.4, RFXcom, Script Connector, BT connector, DI Connector, DooNetwork, HSTouch, WMP plugin, USB-UIRT, BLicon, DenonAVR, WebcamXP, Jon00s MaxiBee and Webpage builder
|

November 16th, 2009, 10:45 AM
|
 |
OverSeer
|
|
Join Date: Jan 2001
Location: Huntsville, Al. USA
Posts: 33,801
|
|
Quote:
Originally Posted by stipus
One day you'll learn how to spell my name
Learning VB.Net might be usefull for many other systems...
|
I fixed my misspelling
This is true but for the true beginner sometimes jumping into .net is a bit daunting and they give up. The beauty of vbs is the beginner doesn't have to worry about defining each variable type. This can be bad but when learning it make things a ton easier.
__________________
-Rupp
|

November 16th, 2009, 10:52 AM
|
 |
Seer Master
|
|
Join Date: Aug 2007
Location: Norway
Posts: 835
|
|
Quote:
Originally Posted by Rupp
The beauty of vbs is the beginner doesn't have to worry about defining each variable type.
|
And that is something that is wrong with VBS. The sooner people learn to declare their variables, the better. It just makes more readable code (especially when the code gets complicated, which probably is going to happen if you like HomeSeer  ).
Developing .NET scripts with tenScripting is extremely easy! 
Just download VB.NET Express and off you go!
__________________
HSPro 2.4, RFXcom, Script Connector, BT connector, DI Connector, DooNetwork, HSTouch, WMP plugin, USB-UIRT, BLicon, DenonAVR, WebcamXP, Jon00s MaxiBee and Webpage builder
Last edited by Moskus; November 16th, 2009 at 11:21 AM.
Reason: spelling
|

November 16th, 2009, 11:20 AM
|
 |
Seer Master
|
|
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 1,391
|
|
If I had to do it over again, I wish I had not gone VBS first. Coding in VB.NET is much easier with tenScripting. Enforcing variable type and definition is key for good programming practices.
Another reason is single vs multi-threading. When you have multiple scripts firing at the top of every hour, etc. you're better off having VB.NET scripts.
__________________
Dell P4 1.4Ghz / 2G RAM
HSPRO 2.4.0.1/ Z-Troller / Z-Wave devices / 2 WDTC-20 thermostats
Z-Troller v1.12 / TI-103 / WGL800 / RFXCom / Oregon Scientific Sensors / Motion Sensors / X10 devices / DS10a
Check out Homeseer's YouTube Channel!
|

November 16th, 2009, 11:36 AM
|
|
Seer Master
|
|
Join Date: Jun 2002
Posts: 849
|
|
Just read the text at the following address and then explain again why you would advise people to code in vbs instead of vb.net:
http://www.tenholder.net/tenWare2/tenScripting/
tenholde
|

November 16th, 2009, 11:55 AM
|
 |
Seer Master
|
|
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 1,391
|
|
well said, tenholde...
__________________
Dell P4 1.4Ghz / 2G RAM
HSPRO 2.4.0.1/ Z-Troller / Z-Wave devices / 2 WDTC-20 thermostats
Z-Troller v1.12 / TI-103 / WGL800 / RFXCom / Oregon Scientific Sensors / Motion Sensors / X10 devices / DS10a
Check out Homeseer's YouTube Channel!
|

November 16th, 2009, 12:25 PM
|
 |
OverSeer
|
|
Join Date: Jan 2001
Location: Huntsville, Al. USA
Posts: 33,801
|
|
Quote:
Originally Posted by rmasonjr
Another reason is single vs multi-threading. When you have multiple scripts firing at the top of every hour, etc. you're better off having VB.NET scripts.
|
I believe you are mixing the beginner world with the advanced world. Most beginners aren't looking to do multi-threading, they simply want to have HS speak a variable for example. I would completely agree if you are going to use a lot of HomeSeer scripts and spend the time to learn a full blown language then .net is the only way to go but most of you guys must have forgotten how it was to get started. The beginner isn't even going to know how to load tenScripting let alone use visual studio. The issue I've seen over and over is the beginner gets discouraged and quits. .vbs is a quick and dirty way to get going quick and have some instant success.
__________________
-Rupp
|

November 16th, 2009, 12:32 PM
|
 |
Seer Master
|
|
Join Date: Aug 2007
Location: Norway
Posts: 835
|
|
Rupp, where do you get the idea that vb.net is that hard to learn?
If learning a simple language as vb.net is discouraging and very hard to understand, then VBS has to be equally hard. And then perhaps scripting isn't for you.
__________________
HSPro 2.4, RFXcom, Script Connector, BT connector, DI Connector, DooNetwork, HSTouch, WMP plugin, USB-UIRT, BLicon, DenonAVR, WebcamXP, Jon00s MaxiBee and Webpage builder
|

November 16th, 2009, 12:40 PM
|
 |
OverSeer
|
|
Join Date: Jan 2002
Location: London UK
Posts: 5,143
|
|
Like most others here, VB.NET is the only way to go for scripts. That said, you also need to know some VBS or the syntax differences between the two.
Homeseer is still back wards when it comes to the immediate script commands for events (i.e. it only supports VBS) and the example given by Stipus would never work. Homeseer also still promotes the startup and shutdown scripts using VBS (.txt) even with the latest version. I find this odd since VB.NET support has been provided for some time by the use of startup.vb and shutdown.vb but never used??
One thing that does still promote the use of VBS in my opinion is writing web pages for Homeseer. This always promotes debate but the speed of pages served by Homeseer is so much faster using asp rather than aspx due to its memory architecture.
__________________
Jon
|

November 16th, 2009, 12:45 PM
|
 |
Seer Master
|
|
Join Date: May 2001
Location: Brookhaven, MS USA
Posts: 1,391
|
|
Quote:
Originally Posted by Rupp
I believe you are mixing the beginner world with the advanced world. Most beginners aren't looking to do multi-threading, they simply want to have HS speak a variable for example. I would completely agree if you are going to use a lot of HomeSeer scripts and spend the time to learn a full blown language then .net is the only way to go but most of you guys must have forgotten how it was to get started. The beginner isn't even going to know how to load tenScripting let alone use visual studio. The issue I've seen over and over is the beginner gets discouraged and quits. .vbs is a quick and dirty way to get going quick and have some instant success.
|
Mutli-Threading is simply a valuable by-product of using VB.NET.
So, you would rather help users speak some text, write to a log, update a device variable using notepad or equivalent with no syntax checking? That will quickly lead to discouragement.
__________________
Dell P4 1.4Ghz / 2G RAM
HSPRO 2.4.0.1/ Z-Troller / Z-Wave devices / 2 WDTC-20 thermostats
Z-Troller v1.12 / TI-103 / WGL800 / RFXCom / Oregon Scientific Sensors / Motion Sensors / X10 devices / DS10a
Check out Homeseer's YouTube Channel!
|

November 16th, 2009, 01:02 PM
|
 |
Seer Master
|
|
Join Date: Aug 2007
Location: Norway
Posts: 835
|
|
Quote:
Originally Posted by jon00
Homeseer is still back wards when it comes to the immediate script commands for events (i.e. it only supports VBS) and the example given by Stipus would never work. Homeseer also still promotes the startup and shutdown scripts using VBS (.txt) even with the latest version. I find this odd since VB.NET support has been provided for some time by the use of startup.vb and shutdown.vb but never used??
|
I've spent hours wondering about the same, and it always annoys me when I have to use the Control for immediate script commands.
Why can't this be optional (for old and stubborn(?) users)?
__________________
HSPro 2.4, RFXcom, Script Connector, BT connector, DI Connector, DooNetwork, HSTouch, WMP plugin, USB-UIRT, BLicon, DenonAVR, WebcamXP, Jon00s MaxiBee and Webpage builder
|

November 16th, 2009, 01:03 PM
|
 |
Super Seer
|
|
Join Date: Feb 2006
Location: Rochester, NY
Posts: 1,506
|
|
Quote:
Originally Posted by Moskus
And that is something that is wrong with VBS. The sooner people learn to declare their variables, the better. It just makes more readable code (especially when the code gets complicated, which probably is going to happen if you like HomeSeer ).
Developing .NET scripts with tenScripting is extremely easy!
Just download VB.NET Express and off you go!
|
I mostly agree. But, although my earlier rant was deliberately exaggerated, I still think it is much easier to start with VBS for simple scripts. VBS was designed for casual programmers. Learning to use it is mostly a learn by example process. Because it is limited in scope, the pertinent examples are relatively easy to capture in a guide book of approachable size.
Vb.net is clearly much more structured and much more capable than VBS, and I've converted nearly all my VBS scripts to vb.net thanks in large part to tenScripting. (A godsend! Without it, I would still be at square -1.  ) That said, I still find that opening a separate application to create a simple script is not that appealing, and I usually start by trying to adapt an existing script in Notepad when I need to create something new. I also find the class structure very confusing. I usually cannot predict which class contains which functionality, and have not found any guides that have been useful - except to ask on this board for help.
That is really my point. If you are dedicated to programming and study vb.net closely, I'm sure it becomes second nature. For those of us who come to HA from other fields, and who see scripting as a necessary evil to accomplish something we consider useful, it is not transparent at all. We still need concrete examples to get started. But, vb.net is so powerful and so comprehensive it is overwhelming for simple tasks. It feels like driving a tractor trailer to get to the corner store.
Quote:
|
Once your script is working correctly, ONLY THEN do you export it into your HomeSeer Script directory for production use.
|
Unfortunately, either I don't fully understand how to use the tool or I'm really incompetent (or both  ), but I find that my most annoying errors are those that involve interactions within the HS environment, and they only surface AFTER I've installed the script and run in for a few cycles - maybe over a few days or weeks - to discover the subtle bugs in my logic. Unfortunately, vb.net didn't change that.
__________________
Mike
____________________________________________________________ __________________
HS 2.3.0.19 || Stargate 2.2 | ACRF2 1.0.3226.27426 | VWSCSV 2.2 | Ultrastatus 1.1.3172.37875 | BLRFID 1.0.35.0 | PowerTrigger 1.3 | NetCam 1.1 | ActiveBackup 2.0.0.26 || Scripts: Weather XML | PerfMon | VDGraph || HW: EeeBox | JDS Stargate | NetworX NX-8E | CAV6.6 w ABUS | Slink-e / CDJ | Compose switches, keypads, firewalls | WGL800 | RFXCOM LAN2 | LaCrosse 2310
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
All times are GMT -4. The time now is 06:32 AM.
|