Date Time Widget scripting question

Sunday, January 20, 2008 by HeirOfSlytherin | Discussion: OS Customization

I have done a date time widget with a digital clock,(found a tutorial on that) but how do you do the scripting for a date time with a analog clock? I tried to replace the digital script with the analog script, but it didn't work.
Chris TH
Reply #1 Sunday, January 20, 2008 6:13 AM
There's aclock docklet by 'Judge' (I can't remember what it's called - seach Wincustomise, it's there, something to do with 'Italian') which has the script for an analog clock.

Basically you have to rotate the 'hands' bitmaps by working out the # of degrees per second/minute/hour. It's reasonably obvious once you see an example.

HTH

Tiggz
Reply #2 Sunday, January 20, 2008 6:47 AM
This is what I use:

Code: vbscript
  1. desktopx.Object("secondhand").rotation = second(now) * 6
  2. desktopx.Object("minutehand").rotation = minute(now) * 6
  3. desktopx.Object("hourhand").rotation = (hour(now) * 30) + (30 * minute(now)/60)
HeirOfSlytherin
Reply #3 Sunday, January 20, 2008 1:39 PM
I already have that scripting for the clock,but how do you put the date scripting and the analog clock scripting together to make a date-analog clock? I have a script for the date-time with digital clock. I omitted the lines to the digital clock and replaced it with the analog script and it didnt work.
HeirOfSlytherin
Reply #4 Sunday, January 20, 2008 1:47 PM
Sub Object_OnScriptEnter
Object.SetTimer 1000, 30000
Call setinfo
End Sub

Sub Object_OnTimer1000
Call setinfo
End Sub

Sub setinfo
desktopx.Object("DayOfWeek").text=WeekDayName(Weekday(now),False)
desktopx.Object("MonthName").text=MonthName(Month(now)
desktopx.Object("Year").text=Year(now)
desktopx.Object("Date").text=Day(now)
t = FormatDateTime(time(),3)'---Get your system time

h= hour(t)'---Get current hour
desktopx.object("hour_hand").Rotation= h * 30 '---Multiply current hour to get correct rotation
m= minute(t)'---Get current minute
desktopx.object("minute_hand").Rotation= m * 6 '---Multiply current minute to get correct rotation
s= second(t)'---Get current second
desktopx.object("second_hand").Rotation= s * 6 '---Multiply current second to get correct rotation
End Sub
This is what i am trying to put together. Date-Time(analog)Widget.
BigDogBigFeet
Reply #5 Sunday, January 20, 2008 2:17 PM
Just create a system date object and apply it to the face of your analog clock. There's a plug in called "Date using text states" which you should already have with DesktopX. It's format is ddd',' MMM dd yyyy which of course you can format to suit your needs.  
HeirOfSlytherin
Reply #6 Monday, January 21, 2008 4:34 AM
For those who are interested. Figured it out. very simple
Sub Object_onscriptenter
object.SetTimer 1, 1000
End Sub

Sub object_ontimer1
t = FormatDateTime(time(),3)'---Get your system time

h= hour(t)'---Get current hour
desktopx.object("hour_hand").Rotation= h * 30 '---Multiply current hour to get correct rotation
m= minute(t)'---Get current minute
desktopx.object("minute_hand").Rotation= m * 6 '---Multiply current minute to get correct rotation
s= second(t)'---Get current second
desktopx.object("second_hand").Rotation= s * 6 '---Multiply current second to get correct rotation
desktopx.Object("DayOfWeek").text = WeekDayName(Weekday(now), False)
desktopx.Object("MonthName").text = MonthName(Month(now))
desktopx.Object("Year").text = Year(now)
desktopx.Object("Date").text = Day(now)
End Sub

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01