Page 1 of 1

Script manipulation of time

Posted: Tue Jan 18, 2005 5:40 pm
by ceejm1
Having read a few topics regarding changing a time property via a soft remote, I realise that I need a script that when run increases/decreases the time value accordingly.



Having zero knowledge of VB, can someone give me an example of a script that will take the time value from a property, increase it by 10 min and then update the same property? From there I expect I'll be able to figure out how to decrease and change the hours. The time property would be hours and minutes only.



Thanks in advance



James

Posted: Tue Jan 18, 2005 9:21 pm
by ScottBot
James,



This should get you started.


Code: Select all

'Get the Time and Date from the property
szTheTime = GetPropertyValue( "Inc Time Script.Test Time" )

' Add 10 minutes to the time
szAdjustedDate = DateAdd( "n", 10, szTheTime )

' Format up the Property value as HouseBot needs it
szNormalized = "Year=" & datepart("yyyy",szAdjustedDate ) & ",Month=" & datepart("m",szAdjustedDate ) & ",Day=" & datepart("d",szAdjustedDate ) & ",Hour=" & datepart("h",szAdjustedDate ) & ",Minute=" & datepart("n",szAdjustedDate )

' Set the Property with the new time.
SetPropertyValue "Inc Time Script.Test Time", szNormalized

Posted: Tue Feb 15, 2005 6:35 pm
by ceejm1
After sometime away from it I have been looking into this problem again.



I have created a script devive with a time property that matches your script, but when I run it it crashes housebot!



Any ideas?



Cheers



James

Posted: Wed Feb 16, 2005 10:31 am
by ScottBot
James,



Are you using the exact same script that I used, or is it a bit different? If it's different, please send it to me at [email protected], so I can look into it.



Also, when HouseBot crashes it creates a dump file that contains diagnostic info. Please look in your \HouseBot\Dump directory and send the latest dump file to me at [email protected].