I wouldn't think the ini file would be simpler. Let me cut and paste your code and try to run it on my computer to see what is up.
Announcement
Collapse
No announcement yet.
Script Help!
Collapse
X
-
Originally posted by nightwalker View PostInteresting, I didn't know you could combine the "dim s as string =hs.DeviceString("#10")
" into one line. It got me past the Name not declared error and give me an expression error. "Script compile error: Expression is not a method.on line 22"
Now that you're nearly a script expert you might want to consider installing the VB Express compiler. It's free from MS (just do a quick google for it).
It will help you identify many of the errors you are seeing before you even run the script within HS.
Cheers
NicolaiNicolai L
Comment
-
Originally posted by NicolaiL View PostMarty
Now that you're nearly a script expert you might want to consider installing the VB Express compiler. It's free from MS (just do a quick google for it).
It will help you identify many of the errors you are seeing before you even run the script within HS.
Cheers
NicolaiMarty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
-
Originally posted by jasv View PostI wouldn't think the ini file would be simpler. Let me cut and paste your code and try to run it on my computer to see what is up.Marty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
-
If you are running this as a .vb script the following should work. Let me know if it doesn't.
I tried it and it worked on my computer
Code:Public Function CommonProc() As String Dim s As String = hs.DeviceString("#10") Dim thisMsg As String = "" '------------------------------------------------------------------------------ If s = "Cloudy" Then thisMsg = hs.Plugin("BLRandom").RandomizeGroup("BLW-Cloudy-Cold") ElseIf s = "Fair" Then thisMsg = hs.Plugin("BLRandom").RandomizeGroup("BLW-Fair-Cold") ElseIf s = "Sunny" Then thisMsg = hs.Plugin("BLRandom").RandomizeGroup("BLW-Sunny-Cold") ElseIf s = "Unknown Precip" Then thisMsg = hs.Plugin("BLRandom").RandomizeGroup("BLW-Unknown") End If Return thisMsg '------------------------------------------------------------------------------ End Function Public Sub Option1(ByVal Parms As Object) Dim speakMsg As String = "" speakMsg = speakMsg & ("Cynthia, the temperature is " & hs.DeviceValue("Z3") & " degrees this " & TimeOfDay()) speakMsg = speakMsg & (" . ") speakMsg = speakMsg & hs.Plugin("BLRandom").RandomizeGroup("Warm Car") speakMsg = speakMsg & (" . . ") speakMsg = speakMsg & (". Right now we have ") speakMsg = speakMsg & hs.DeviceString("#10") speakMsg = speakMsg & (" conditions outside. ") speakMsg = speakMsg & (" . ") speakMsg = speakMsg.Replace("Precip", "Precipatation ") hs.Speak(speakMsg & CommonProc(), True) speakMsg = Nothing End Sub Function TimeOfDay() As String Select Case Now.Hour Case Is < 12 Return "Morning" Case 12 To 17 Return "Afternoon" Case 18 To 24 Return "Evening" Case Else Return "Error" End Select End Function
James
Running HS 3 on Win10 .
Comment
-
yes, i run it as a vb script. Seeing how some of the syntax is .txt that could explain the error?Marty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
-
That worked, now I can go finish it. Thank you very much.
I see my problem was I ended a function with an end sub instead of an end function. Duh!!!!!
Again, thanks to everyone for the bits of education.Marty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
-
Originally posted by nightwalker View PostThat worked, now I can go finish it. Thank you very much.
I see my problem was I ended a function with an end sub instead of an end function. Duh!!!!!
Again, thanks to everyone for the bits of education.
One final point; now that you are considering installing VB Express you should really consider perfecting your 'development environment' with tenholde's script compiler. It means you can run and debug scripts straight from the VB compiler and test them against your live HS instance. Once you are satisfied they are working you simply export them and the finished product sits in your HS\scripts directory.
Good luck...
NicolaiNicolai L
Comment
-
Yeah, I had that installed at one point too At my last machine rebuild had so much junk on it that I decided to install things as I needed them. This was the first time I could have used them and to be honest I didn't think i'd need them for this little thing. When I'm wrong, I'm wrong big time.Marty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
-
BLRandom does an amazing job of making my TTS announcements much more life like. Instead of setting up a TTS announcement that says the same thing every time I can set it up with many phrases that get chosen at random. I have a lot of TTS going on and I noticed the family would pretty much tune it out after hearing the same exact announcement everytime. This particular script is one that tells my wife that it's cold out and she might want to warm up the car before she leaves. BLRandom lets me tell her that in 25 different ways, picked at random by calling the plug-in, so things don't get stale. It also gives her the current weather conditions outside and reminds her to take an umbrella if it's raining, etc. Different things for different conditions and temperatures, all run through the plug-in so the phrases get switched around all the time and stay fresh.
It's been a real WAF booster here.
BTW I have to tell you I've never used the options in scripts before. I can see where this could be very useful in some circumstances. I appreciate the help with it.Marty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
-
This is probably the wrong place to ask this and the question if probably more complicated than I think but anyway, here goes.
Can someone, without getting way to technical, tell me the difference between a "Sub Main" and a "Public Sub Main"?Marty
------
XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
Playing with HS3 a bit but it's just play at this point.
Comment
Comment