Script manipulation of time

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
ceejm1
Member
Posts: 32
Joined: Sat Sep 18, 2004 9:58 pm

Script manipulation of time

Post 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
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post 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
Scott
ceejm1
Member
Posts: 32
Joined: Sat Sep 18, 2004 9:58 pm

Post 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
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post 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].
Scott
Post Reply