Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 12 made on Sunday February 8, 2009 at 00:43
Spudnic
Long Time Member
Joined:
Posts:
January 2009
10
I created a weather.com script, available here on remotecentral, that you might be able to leverage / modify. It pulls in XML from weather.com, and it contains the moon phase as well in the data set. It would show you how I've done it to either write your own, or pick up what I've done for modifications.

I suspect what you're trying to do is switch based on a text based variable. So, right now weather.com says the moon phase is "Waxing Gibbous" ... you'd have to know the exact textual returns that are possible, and then test against those.

Someone asked me, "how do I get the days in the forecast to be German." For this I'm considering doing something similar ... have a translation page. I know weather.com is going to give me "Monday", "Tuesday", etc. I'm going to setup a translation page which would allow him to put in "Montag", "Dienstag", etc. Then I'll test for "Monday" from weather.com and replace it with the text he's entered in the translation page. For this, you could use a simple IF ... Then .. Else construct ... or there is another option of Switch ...

switch(varDayName) {
case "Monday":
widget("mywidget").label = widget("mon_translate").label;
break;
case "Tuesday":
widget("mywidget").label = widget("tue_translate").label;
break;
}

If you're learning JavaScript, I'd like to highly recommend http://www.devguru.com as a reference. It's not good for learning, but it's indespensible as a reference (I always forget syntax).

Since I know that there are limited return options on the days of the week, I can cover all the cases. At the time that we add another day of the week, the script would need to be rewritten ... but that's about as unlikely as coming up with more phases of the moon.

I hope this helps, I believe your details helped me with where you were having issues.


Hosting Services by ipHouse