Stopping Scripts

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Stopping Scripts

Post by Richard Naninck »

@Scott;

Lately I ran in some unexplainable stuff while writing running scripts.
While writing scripts I usually put MsgBoxes in them to see what happens and if all is fine, I remove them from the script.
A few times already I still saw the MsgBox output appear after having removed it and restarted the script. After some time I figured out that when HB is restarted it appears that some running scripts remain running. All of the scripts have the On Error Resume Next set so after killing HB, they would probably not fail on not having the HB specific commands like SetPropertyValue etc.
Just now while putting a song on the queue, the song appeared twice. This was because two instances of the same script appeared to be running. Killing HB fixed it.
Not sure how or when it happens but I am pretty sure that sometimes the Stopped state doesn't "really" stop the internals of the script. This makes debugging scripts rather difficult because stuff happens that cannot be explained otherwise.
Does this or could this ring any bells?
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Stopping Scripts

Post by ScottBot »

Richard Naninck wrote:Does this or could this ring any bells?
When you set the running state to "Stopped", the plugin will notify the script engine (Microsoft code) to abort. It should terminate any running thread, even if it is stuck (like in an infinite loop).

However, it's possible that there is some additional blocking/threading going on within the script engine that is preventing this from happening. I can't really speculate, since it's inside the MS code.
Scott
Post Reply