I think some of the basic information you'll need is AM/PM and the hour.
For example:
'Called when the script is executed
Sub Object_OnScriptEnter
Object.SetTimer 1,60000
Object_OnTimer1
End Sub
Sub Object_OnTimer1
t = FormatDateTime(now,3)
timeofday = Right(t,2)
h = Hour(t)
msgbox "Time: " & t & vbcrlf & "Time of day: " & timeofday & vbcrlf & "Hour: " & h
End Sub
Then you can take those pieces of information and change the image or state of the object accordingly.
For example, this script will show the 6am state from 6am to 12pm, at which point it will change to the 12pm state and show that until 6pm.:
'Called when the script is executed
Sub Object_OnScriptEnter
Object.SetTimer 1,60000
Object_OnTimer1
End Sub
Sub Object_OnTimer1
t = FormatDateTime(now,3)
timeofday = Right(t,2)
h = Hour(t)
If h => 6 And h < 12 Then
If timeofday = "AM" Then Object.State = "6amstate"
If timeofday = "PM" Then Object.State = "6pmstate"
Else
If timeofday = "AM" Then Object.State = "12amstate"
If timeofday = "PM" Then Object.State = "12pmstate"
End If
End Sub
To change the look you can either use multiple states and switch between those, or just change the png on one state. In the example below, the object has one state and the images are included as custom files (Properties > Summary > Custom Files) The script simply gets the image from where it's stored (Object.directory) and applies it to the state.
Sub Object_OnTimer1
t = FormatDateTime(now,3)
timeofday = Right(t,2)
h = Hour(t)
If h => 6 And h < 12 Then
If timeofday = "AM" Then Object.picture = Object.Directory & "6am.png"
If timeofday = "PM" Then Object.picture = Object.Directory & "6pm.png"
Else
If timeofday = "AM" Then Object.picture = Object.Directory & "12am.png"
If timeofday = "PM" Then Object.picture = Object.Directory & "12pm.png"
End If
End Sub
And if you ever intend to do a new image every hour (for a total of 24 images), you can streamline the code further by naming each image according to the hour, e.g. "12AM.png" , "3PM.png", including them as custom files, and using this script:
Sub Object_OnTimer1
t = FormatDateTime(now,3)
timeofday = Right(t,2)
h = Hour(t)
newimage = h & timeofday
Object.Picture = Object.Directory & newimage & ".png"
End Sub
Time and date stuff:
http://wiki.wincustomize.com/wiki/DesktopX:_Builder_Mode_for_Beginners_Pt_2
RomanDA's tut PART 1, PART 2