Interrupting a task - how to?

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
yaccri
HouseBot Special Member
Posts: 304
Joined: Wed May 07, 2003 2:19 pm
Location: Tel-Aviv, Israel
Contact:

Interrupting a task - how to?

Post by yaccri »

I want to control drapes. That requires closing a contact (using an rs232 digital IO unit), sleeping enough time (15 seconds) and releasing the contact.



In order to be able to interrupt that action, I created vb scripts for UP, DOWN and STOP. Each script changes the others' device's state to "stopped" to interrupt the other tasks in case they are running.



IS IT OK TO CHANGE A SCRIPT DEVICE'S STATE TO "STOPPED"?



After making several interrupts, I get error messages on the HB server:

unable to load the script file [my script file]. Error=[The operation completed successfuly].

Unable to compile the script.



After a few more interrupts, the server crashes with error:

AppName: housebotserver.exe AppVer: 2.0.0.0 modName: ntdll.dll

ModVer: 5.1.2600.1217 Offset: 00019ecd



Any suggestions on how else to interrupt tasks or to fix the problem?



Thanks,

Yoram
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Interrupting a task - how to?

Post by ScottBot »

yaccri wrote:IS IT OK TO CHANGE A SCRIPT DEVICE'S STATE TO "STOPPED"?


Yes... well it should be. Another option would be to add a Property to the Script Device that the script will check and abort itself if changed.



If there was a dump file generated, could you send it to me?
Scott
yaccri
HouseBot Special Member
Posts: 304
Joined: Wed May 07, 2003 2:19 pm
Location: Tel-Aviv, Israel
Contact:

Post by yaccri »

Got it done in a different way.



Instead of interrupting the vb script, I created a sleep device and started/stopped it from the vb scripts.



So now the scripts look like:



' =================================

On Error Resume Next



SetPropertyValue "Sleep Timer-Drape.Running", "No"



' close/open contacts here

' ...



' Sleep enough time

SetPropertyValue "Sleep Timer-Drape.Running", "Yes"



Do While True

If (GetPropertyValue("Sleep Timer-Drape.Running") <> "Yes") Then

Exit Do

End If

Loop



' More stuff here

' ...

' =================================





One nice thing about HB (among many others) is that things can be done in different ways.



Scott, I guess that stopping a running vb script manualy may cause crashes.



Yoram.
Post Reply