Haiku HaikuHelper Javascript includes not loading on startup

snarkyninja

Member
Hi all, having a little problem with the helper.include() function - I've included four files at the top of my script, but when HH starts the files aren't actually included (I get a bunch of errors along the lines of "Unhandled exception on line 92: can't find variable functionNameHere()"). If I manually click the "Run Script" button though, everything works fine after that until the next time the application closes and re-opens, at which point I have to click the button again.
 
95% of the time this isn't an issue, but when the computer restarts, or if there's an App Store update, the automation stops working until I can get back to the computer, acknowledge all the errors, and click the "Run Script" button again. Thoughts?
 
We'll look into it and fix in the next update if there is a bug. Is the error literally that every time? Or does it show your function name?
 
The error does show the function name, usually either getTimeFromTimestamp (in the onSyncStart function) or sendAlert (in the various zone/unit/button callbacks).
 
You should be able to replicate the problem as follows:
 
* Define a function in an included Javascript file.
* Add a call to the function in onSyncStart (or any callback, but onSyncStart is easy to test).
* Hit "Run Script".
* Wait for a sync, or manually sync now. The function should work as expected.
* Close HaikuHelper and then re-open. Don't hit "Run Script". Wait for a sync.
* The script error should pop up.
* Now click "Run Script". On the next sync everything should work fine again.
 
If you need any more info or want to see the code, let me know.
 
where are you calling the helper.include() function from? Make sure you run it outside of any event callback. Ie. Right at the top of the script.
 
Here's a picture of the error I'm getting for reference.
 
http://postimg.org/image/50sluspbd/
 
Also, controller logs:
 
 

2014-02-22 20:57:06 HaikuHelper v4.03 starting up…
2014-02-22 20:57:07 ControllerNameHere: Initializing scripting environment…
2014-02-22 20:57:08 ControllerNameHere: Applying controller script…
2014-02-22 20:57:08 Starting HTTP service on port 9399…
2014-02-22 20:57:10 Sync » Starting forced sync operation…
2014-02-22 20:57:11 Notification » ControllerNameHere: Connection to controller established
2014-02-22 20:57:11 Notification » Push » ControllerNameHere: Sending push notification: Connection to controller established
2014-02-22 20:57:11 Sync » ControllerNameHere: Syncing stage 1 of 5: Clock…
2014-02-22 20:57:12 Sync » ControllerNameHere: Syncing stage 2 of 5: Controller Configuration (Reading Configuration)…
2014-02-22 20:57:33 Sync » ControllerNameHere: Syncing stage 3 of 5: Controller Configuration (Loading Objects)…
2014-02-22 20:57:34 ControllerNameHere: Unhandled exception in script on line: 77 in function "onSyncStart": Can't find variable: getTimeFromTimestamp
2014-02-22 20:57:34 Sync » ControllerNameHere: Syncing stage 4 of 5: Controller Configuration (Saving)…
2014-02-22 20:57:34 Sync » ControllerNameHere: Syncing stage 5 of 5: Rain Advisory…
2014-02-22 20:57:35 Sync » Rain Advisory » ControllerNameHere: Precipitation for Sat: 0.0mm
2014-02-22 20:57:35 Sync » Rain Advisory » ControllerNameHere: Precipitation for Sun: 0.3mm
2014-02-22 20:57:35 Sync » Rain Advisory » ControllerNameHere: Precipitation for Mon: 0.1mm
2014-02-22 20:57:35 Sync » Rain Advisory » ControllerNameHere: Precipitation for Tue: 11.2mm
2014-02-22 20:57:35 Sync » Rain Advisory » ControllerNameHere: Precipitation for Wed: 1.0mm
2014-02-22 20:57:35 Sync » Rain Advisory » ControllerNameHere: Setting "RainAdvisory" flag to 12mm…
2014-02-22 20:59:01 ControllerNameHere: Unhandled exception in script on line: 77 in function "onSyncStart": Can't find variable: getTimeFromTimestamp
2014-02-22 20:59:06 ControllerNameHere: Initializing scripting environment…
2014-02-22 20:59:06 ControllerNameHere: Applying controller script…
2014-02-22 21:00:07 Sync » Rain Advisory » ControllerNameHere: Setting "RainAdvisory" flag to 12mm…
 
In both of the above, I've removed the controller name as it's my actual last name. You can see at initial startup (20:57:34) the error is present, as well as for any subsequent synchs (20:59:01). At 20:59:06 I clicked the "Run Script" button, and at the next sync (21:00:07) there are no errors.
 
Back
Top