I AM A NEWCOMER TO DESKTOPX WIDGETS AND I WOULD LIKE TO HAVE IN MY DESKTOP SOMETHING LIKE A BIG ICON OF A SUN THAT BECOMES INTO A MOON AS THE DAY PASSES, I DO NOT WANT AN ANIMATED SUN THAT MOVES AROUND THE SCREEN I WANT THE OBJECT TO STAY FIXED IN ONE CONER OF THE SCREEN. DOES ANYBODY COULD HELP ME IN DOING THIS OBJECT?

THANKS IN ADVANCE


Comments
on Jul 21, 2009

Capslock...

on Jul 21, 2009

Sorry

on Jul 21, 2009
on Jul 21, 2009

This is very simple... You only need to know the longtitude and latitude of your city to calculate sunrise/sunset time to change the state of your icon. Use the Google and you'll find tens of examples. Your script will be about 100 lines total...

on Jul 21, 2009

or you could get Natural Desktop it has a corner orb that changes with time

on Jul 22, 2009

Thanks to Zubaz, Vad_M an Bichur.

Regarding the reply from Vad_M I think the best solution is to create an static icon of a sun that at 07.00 PM changes its state and becomes a moon and maybe this icon could be accompanied with a clock or a text date. The solution of scripting 100 lines seems impossible to me.

Re to Zubaz and Bichur reply I will try to edit the ones you mention.

Thanks a lot for your help.

 

on Jul 22, 2009

Regarding the reply from Vad_M I think the best solution is to create an static icon of a sun that at 07.00 PM changes its state and becomes a moon and maybe this icon could be accompanied with a clock or a text date.
This is much different than your imnitial request.

Your initial rquest involved finding sunrise and sunset for your location, having an image that changed the amount of sun/moon percentage as the day changed.

Your new requset should be much easier to accomplish.

on Jul 22, 2009

Yes, Zubaz, the first thing is having clear what do you want, and the second how to express it correctly in English, and the third one having some knowledge of vbscript. Well, I do not know anything about vbscripting and my English is not perfect.  Sorry and thanks for your patience.

What I need to do is as follows: I have some pngs with images of the sun and some of the moon and i want to create an static icon with a text clock or date or calendar or with all together that simply changes the png for example every hour or every two hours just to show the part of the day according to the local time of my computer (i.e. the morning, the afternoon, the night, the dusk, the dawn).

For example at 6. a.m the icon shows a sun with some mist at 12. p.m. a complete sun at 6. p.m the icon changes and shows half a moon and at 12.00 a.m. a full moon. Something that for you it's easy but difficult for me. I have been trying different ways with desktop x but i've been unable to find the solution.

I do not want to have any exact phase of the moon or exact position of the sun or icons running around the desktop.

I have seen good examples of rotating moon and the blue marble in the wincustomize galleries. It is something similar to that but does not need to be animated, just to show the time and date and to change its look depending on the hour of the day.

It's just to have some eyecandy in the desktop and such a kind of different clock to use instead the weather widgets now that i have decided to delete all of them from my hard drive due to all the problems they have caused recently.

on Jul 22, 2009

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

 

on Jul 23, 2009

Sviz thanks a lot  for your help and your detailed info. Now i can follow your instructions and hope i'll get something that works.

on Jul 30, 2009

Sorry to bother you again, Sviz

I,ve tried to put all your scripts together but nothing works. This is because I do not have any notion about vbscripting.

I,ve been playing with macosx clock from julyness https://www.wincustomize.com/skins.aspx?skinid=4122&libid=3 and the only thing i have got is to change the clock face at 12 am and 12 pm, this means two only states and two only clock faces.

Nevertheless this is more or less what i need. That's a digital text clock (not analog) that has 24 states (one for every hour of the day), every state has a png associated that changes every hour. I have been messing around with the internal script of the above mentioned widget but i cannot figure how to add to the script these 24 states.

As this widget is intended to be for personal use only, i request you if posible to be so kind to inform me or provide me with the full script. Believe me i,ve been trying for hours but i have been unable to find any solution.

Thanks in advance for your help.

 

on Jul 30, 2009

Ok. Julynessi's script looks like it changes the brightness of the same state, darker for PM, brighter for AM.

What you want is to change the state entirely. First, you have to name your states accordingly (e.g. 12am, 1am, 3pm, etc.) and apply your images.

Then you can use this script:

'Called when the script is executed
Sub Object_OnScriptEnter
 Object.SetTimer 1,30000 '--30 second timer
 Object_OnTimer1
End Sub

Sub Object_OnTimer1
 t = FormatDateTime(now,3) '--get time
 timeofday = Right(t,2) '--get am / pm
 h = Hour(t) '--get hour
 
 newstate = h & timeofday '--set state, e.g. 4am
 
 Object.State = newstate '--apply state
End Sub

 

It's the easiest way I know how to do it.

on Jul 30, 2009

Ok, thanks again. I presume I have to apply the script as it is in your post.

 

I'll try it this evening and keep You informed about the result.

 

Thanks indeed.