Go Back   xda-developers > Windows Mobile Development and Hacking > Windows Mobile Apps and Games


Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 13th January 2008, 03:44 PM
schettj schettj is offline
Senior Member
 
Join Date: Nov 2006
Posts: 109
Default S2U2 UserWeather MortScript

Figured I would make a thread for this to keep the S2U2 thread uncluttered

A_C's wonderful S2U2 introduced support for weather forecast display if you used some apps to get weather, or you could use "User" generated weather data in the registry.

I never have good luck with those weather apps, but I am handy with mortscript - the following script works with S2U2 *and* rlToday, giving you the current weather and the forecast for today or tomorrow.

REQUIRED:

SU2U 0.95 or later, installed, with UserWeather enabled in settings
MortScript 4.1 installed

CHANGES:

In V2.1 I've cleaned up the system paths so they are not hard coded
* this should work no matter where you have MortScript installed

In V2 I've updated the script as follows:
* if your cellular radio is OFF, the weather check is skipped - it will try again on the next scheduled time (ie, it works right when you are in flight mode)
* if there is any runtime error at all, the script quietly quits now, and tries again on the next scheduled time

TWEAKS:

Near the top of the script, you must edit the various settings (see below) to get your weather, and to have it update as often as you want.

You can also change some lower-level parts of the script - if you don't want it to switch to tomorrow's weather forcast after 4pm, remove these lines from the script:
Code:
        # get tomorrow's weather if hour past 4pm (>15)
        if (hour > 15)
                notDone = -1
        endif
If you want to change what is shown on the S2U2 screen, edit this line in the script:
Code:
                weather="W|"&code&"|"&hitemp&"|"&lotemp
Change the W to an S to get the Spb weather icons
Change code to ccode to show the icon for the current weather, not the forecast for the day
Change lotemp to temp to display the forecast hi temp / current temp

INSTALLING AND RUNNING

Unzip the attached zip file
Copy notiweather.mscr to /Windows/Startup
If you have run a previous version of this script, you can copy clearweather.mscr anywhere onto your device, and run it once - it will ask if it can clear the notifications... tap Yes. Then you can delete the script

Run the notiweather.mscr script by navigating to it in a file browser on your device and double tappping it. It should silently run - if it works you should see some data activity. Run S2U2 and see if you've got some weather.

It is safe to run the script manually to update the weather - it will also update the next run time to be whatever you have it set for in the script.

WEATHER PANEL ICONS
S2U2 has an incomplete set of Weather Panel Icons.

Go to http://www.desktopsidebar.com/forums...ded&show=&st=&

Link for full stardock set of weather icons is at bottom:

http://www.desktopsidebar.com/forums...e=post&id=1489

That set includes the missing 33.png, among many others - unzip those into your gfx\weather folder overwriting what's there, if you're using UserWeather and don't have a full weather icon set. Seems to make S2U2 much happier - still not sure if/when the weather display is updated, will try and nail down some examples for A_C to test.

TROUBLESHOOTING/INTERNATIONAL
One user reports that the code used to automatically connect to the internet fails on his device. Changing the Connect() call as follows fixed it:

Original line:
Connect("The Internet")
Change to:
Connect("Internet")

Try that if the script complains for the connect call.

Original post: http://forum.xda-developers.com/show...&postcount=337

Attached is a mortscript that uses yahoo's weather rss feed to fetch the weather and put it in the right place,right format for S2U2 "userweather" - so you can have weather even if you don't have a weather app

Unzip notiweather.zip, and then edit notiweather.mscr in a text editor...
You NEED to edit the file before you put it on your pda - at the top are three settings:

Code:
# USER SETTINGS, CHANGE AS DESIRED

# how often to try and get the weather
delayHours = 2

# your location (see http://developer.yahoo.com/weather/ on finding your location)
location="95129"

# desired units for temp, f or c
units="f"
Change those as desired, save, and copy the script to /Windows/Startup

You can launch the script manually or soft reset.

The script uses the notification manager to run every delayHours and fetch your weather.
It issues a Connect call to "The Internet" if no network connection is present.

It formats the weather correctly and puts in in two registry locations:

#for s2u2 UserWeather
RegWriteString("HKCU", "\Software\A_C\S2U2\", "UserWeather", weather)

#for rltoday
RegWriteString("HKCU", "\Software\emerym\", "Weather", rlweather)

If you are just using S2U2, all you need to do is edit your registry and add ShowWeather, DWORD 5.

If you also use rltoday, you can use that second registry value in your skin.xml to get a string with the current weather + today (or tomorrow if after 4pm's) weather and hi temp
Code:
<Registry x="119" y="52"key="key="HKEY_CURRENT_USER\Software\emerym\Weather"  alignment="center">
</Registry>
If not, you can just ignore that, or even edit the script and cut out those parts...

It's all working very well. Thanks to A_C for this great app!

Lemme know if anyone runs into any issues.

Change log:
V 2.2: 15-01-2008 - use system paths from Mortscript to set up notifications
V 2.1: 13-01-2008 - skip check if cell radio off, handle errors cleanly
V 2: 22-12-2007 - first working version
V 1: unreleased test version
Attached Files
File Type: zip notiweather21.zip (2.0 KB, 3941 views)

Last edited by schettj; 16th January 2008 at 06:20 PM..
Reply With Quote
Sponsored Links

  #2  
Old 13th January 2008, 09:11 PM
holmanm's Avatar
holmanm holmanm is online now
Senior Member
 
Join Date: Apr 2006
Posts: 550
Default

What version of Mortscript are you using? I'm using 4.1 and I got "DelayHours command unkown". 4.1 wants set DelayHours,2. So I assume we are using diffent versions.

Mike H
Reply With Quote

  #3  
Old 13th January 2008, 09:26 PM
Ixtana_ran Ixtana_ran is offline
Senior Member
 
Join Date: Mar 2006
Location: Stoke-on-Trent
Posts: 158
Default

Quote:
Originally Posted by holmanm View Post
What version of Mortscript are you using? I'm using 4.1 and I got "DelayHours command unkown". 4.1 wants set DelayHours,2. So I assume we are using diffent versions.

Mike H
I'm on 4.1 and it works for me. Is it because it should be delayHours = 2 ?
__________________
Changed phone to LG-GM750
Don't have time to personalize phone but reasonable happy with it.
Reply With Quote

  #4  
Old 13th January 2008, 10:52 PM
holmanm's Avatar
holmanm holmanm is online now
Senior Member
 
Join Date: Apr 2006
Posts: 550
Default

Quote:
Originally Posted by Ixtana_ran View Post
I'm on 4.1 and it works for me. Is it because it should be delayHours = 2 ?
My bad. Somehow I still had Mortscript 3.1 loaded. I loaded 4.1 and it works perfectly. Thanks.

Mike H
Reply With Quote

  #5  
Old 13th January 2008, 11:34 PM
lawmangrant's Avatar
lawmangrant lawmangrant is offline
Member
 
Join Date: Sep 2006
Location: Spring Hil, TN
Posts: 76
Default

I put this mortscript on my device, and I do not get any errors, but nothing is displaying on my s2u2 lock screen. Do I need to wait for it to update?
Reply With Quote

  #6  
Old 14th January 2008, 02:08 AM
zard zard is offline
Senior Member
 
Join Date: Jul 2005
Posts: 1,239
Default

I am using SU2U version 0.97 and MortScript 4.1. When I launch manually, I could get the weather infor. On the other hand, the auto update always complains of Mortscript not being able to be run. I had set the updating to 1 hour internal. Not sure if there is a limitation on how ofter Mortscript could be run or that 2 hours is the lowest interval that I can set.
Reply With Quote

  #7  
Old 14th January 2008, 04:08 AM
schettj schettj is offline
Senior Member
 
Join Date: Nov 2006
Posts: 109
Default

It should "just work" with mortscript 4.1, however it depends on the installed mortscript being in a specific location.

For those who have problems, you might try editing the lines

# kill any lingering notification
RemoveNotifications("\Windows\MortScript.exe", "\Windows\Startup\notiweather.mscr" )
# set notify for myself at next time
RunAt( utime, "\Windows\MortScript.exe", "\Windows\Startup\notiweather.mscr" )

Near the top. They're going to need to have the correct path to the Mortscript executable - mine is in the \Windows folder, but it could be \Program files\Mortscript or even somewhere on your storage card.
Reply With Quote

  #8  
Old 14th January 2008, 05:57 AM
schettj schettj is offline
Senior Member
 
Join Date: Nov 2006
Posts: 109
Default

Quote:
Originally Posted by lawmangrant View Post
I put this mortscript on my device, and I do not get any errors, but nothing is displaying on my s2u2 lock screen. Do I need to wait for it to update?
You do need to run it once - assuming it runs correctly the first time (see the note above regarding the path to the executable) it should update the weather right away - you should see the data activity and then, within a minute, the weather should update if you've set S2U2 to use UserWeather.

I'm going to check tomorrow, I am pretty sure I can get rid of the path to the executable in the code - sloppy on my part, sorry! That's the hazard of releasing scripts you write for your own use
Reply With Quote

  #9  
Old 14th January 2008, 06:27 AM
lawmangrant's Avatar
lawmangrant lawmangrant is offline
Member
 
Join Date: Sep 2006
Location: Spring Hil, TN
Posts: 76
Default

I am hoping this can get working...I miss having a temp on my phone. I used to be a big fan of weatherpanel, but it left a lot of undeletable junk on my phone.

I have MortScript 4.0, does that matter?

Also, mine was in an A2DP folder, I just copied it to the windows folder.

Just tried this, and still no luck.

I am running WM5 with a Treo700wx.
Reply With Quote

  #10  
Old 14th January 2008, 07:09 AM
lawmangrant's Avatar
lawmangrant lawmangrant is offline
Member
 
Join Date: Sep 2006
Location: Spring Hil, TN
Posts: 76
Default

OK...
I installed MortScript 4.1 and got this working.

It gives me tongiht's forcast, but gives me a SUN with CLOUDS. It seems to be the wrong icon.

Also, any way to edit this to display the current temparture.
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:50 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.