Jump to content

Advanced Dopplar


layer
 Share

Recommended Posts

(RADAR FOR THE US ONLY, SORRY :">)

Hello...

I want to thank gaforst for his function to dock windows :( And everyone else for their help :">

Needs latest BETA, not sure when the bug was fixed, but if you try and use 3.1.1 then something goes wrong with the painting of the picture, so just use the latest BETA!!

My old dopplar radar only had a dopplar radar. Now it has a radar of rainfall, drought, lightning strikes, 24hr rainfall estimate, and tropical moisture near Africa where most hurricanes start off. I'm very into weather... So I love this stuff. I plan on adding more when I do, but I want to take a break now... Sorry the first radar is only for my area in where I live. You can find the picture for your area and replace the URL in InetGet :whistle: In fact, that may be something I'll add in the future for people who know how to get the URL of a picture. Anyways, here it is :D

Dim $pic = 1, $BS_FLAT = 0x8000

;This is smaller than 800x600, so you should have no troubles using that resolution
$gui1 =    GUICreate("Weather Maps", 700, 515, (@DesktopWidth - 750) / 2, 50)
DirCreate(@TempDir & "\WeatherMaps")
InetGet("http://image.weather.com/web/radar/us_nyc_closeradar_large_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
$echo =    GUICtrlCreatePic(@TempDir & "\WeatherMaps\dopplar.jpg", 0, 0, 700, 485)
$dopplar =  GUICtrlCreateButton("Doppler Radar", 0, 490, 100, 20, $BS_FLAT)
$trops =      GUICtrlCreateButton("Tropics", 105, 490, 100, 20, $BS_FLAT)
$lightning =  GUICtrlCreateButton("Lightning", 210, 490, 100, 20, $BS_FLAT)
$24rainfall = GUICtrlCreateButton("Predicted Rainfall", 315, 490, 100, 20, $BS_FLAT)
$drought =  GUICtrlCreateButton("Drought Severity", 420, 490, 100, 20, $BS_FLAT)
$temps =      GUICtrlCreateButton("Temperatures", 525, 490, 100, 20, $BS_FLAT)
;Had some extra room so I stuck this in, could be used for many things
$opt =      GUICtrlCreateButton("Options...", 630, 490, 70, 20, $BS_FLAT)

GUISetState(@SW_SHOW, $gui1)
AdlibEnable("_GetEcho", 30000)

While 1
   $get = GUIGetMsg()
   Select
      Case $get = -3
         Exit
      Case $get = $dopplar
         $pic = 1
         _GetEcho()
      Case $get = $trops
         $pic = 2
         _GetEcho()
      Case $get = $lightning
         $pic = 3
         _GetEcho()
      Case $get = $24rainfall
         $pic = 4
         _GetEcho()
      Case $get = $drought
         $pic = 5
         _GetEcho()
      Case $get = $temps
         $pic = 6
         _GetEcho()
      Case $get = $opt
       ;Do option-related stuff here
   EndSelect
WEnd

Func _GetEcho()
   If $pic = 1 Then
      InetGet("http://image.weather.com/web/radar/us_nyc_closeradar_large_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
      $name = "\dopplar.jpg"
   ElseIf $pic = 2 Then
      InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", @TempDir & "\WeatherMaps\trops.jpg", 1, 0)
      $name = "\trops.jpg"
   ElseIf $pic = 3 Then
      InetGet("http://image.weather.com/images/maps/severe/map_light_ltst_4namus_enus_600x405.jpg", @TempDir & "\WeatherMaps\lightning.jpg", 1, 0)
      $name = "\lightning.jpg"
   ElseIf $pic = 4 Then
      InetGet("http://image.weather.com/web/maps/radar/regions/us_rainfall_est_yesterday_600_en.jpg", @TempDir & "\WeatherMaps\24rainfall.jpg", 1, 0)
      $name = "\24rainfall.jpg"
   ElseIf $pic = 5 Then
      InetGet("http://image.weather.com/images/maps/current/palmer_drought_720x486.jpg", @TempDir & "\WeatherMaps\drought.jpg", 1, 0)
      $name = "\drought.jpg"
  ElseIf $pic = 6 Then
      InetGet("http://image.weather.com/images/maps/current/acttemp_600x405.jpg", @TempDir & "\WeatherMaps\temps.jpg", 1, 0)
      $name = "\temps.jpg"
   EndIf
   GUICtrlSetImage($echo, @TempDir & "\WeatherMaps\" & $name)
EndFunc;==>_GetEcho

Func OnAutoItExit()
   AdlibDisable()
   GUIDelete($gui1)
   DirRemove(@TempDir & "\WeatherMaps\", 1)
EndFunc;==>OnAutoItExit

Enjoi :dance::dance:

EDIT: Sorry to the people who live outside of the US :">

Edited by layer
FootbaG
Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Yea, the buttons are pretty big... But I'm running at a resolution of 1024x768. WHOA! I just tested it on 800x600 and the window doesn't even fit on the screen... Sorry all you 800x600 users :"> This is the second program I've made that only fits for 1024x768.

On the flip side, glad you like it :whistle:

Edited by layer
FootbaG
Link to comment
Share on other sites

Very nice, layer,

The presentation is so professional in your release. The code is nice and tidy. You have scored high points with this one. 800x600 resolutions should be included for it's usage. I run at 1200x1600, so I have no problem.

Did receive a undeclared error with $pic. Looks like the AdlibEnable runs the _GetEcho func after 30 seconds, with $pic within it. Just assign $pic = 1 at the top of the script should fix it. You could try the $ws_popup style on the picture window? See if that creates a better look? I agree with the button size. Before you know it, 800x600 will be catered for. Resizing after launch could be an option?

:whistle:

Link to comment
Share on other sites

Very nice, layer,

The presentation is so professional in your release. The code is nice and tidy. You have scored high points with this one. 800x600 resolutions should be included for it's usage. I run at 1200x1600, so I have no problem.

Did receive a undeclared error with $pic. Looks like the AdlibEnable runs the _GetEcho func after 30 seconds, with $pic within it. Just assign $pic = 1 at the top of the script should fix it. You could try the $ws_popup style on the picture window? See if that creates a better look? I agree with the button size. Before you know it, 800x600 will be catered for. Resizing after launch could be an option?

:D

<{POST_SNAPBACK}>

Thanks for the kind words :D

About the $pic variable, thanks ! I guess I was so excited about it, I was just zipping through the radars and THEN waiting 30 seconds which will NOT cause a crash because $pic has been assigned. So I did as you said and added a $pic = 1 at the top. Thanks :D About the pop up window style... Well. I just tried it, and there's one problem... Not sure if there's a way around it. But, you can't minimize a pop up window :( Even when the other window is minimized, the popup window stays... But that's ok, because I kind of like the 2 borders... But, I wouldn't mind your idea if it worked :dance: About the 800x600, I'll definatley create something for that... Either a duplicate of the script, with different sizes, or a GUI with radio controls for the sizes, then write to an INI so they don't have to deal with that GUI everytime they start up... And have a small button on the MAIN GUI that asks if they want to change sizes... We'll see what tomorrow brings...

I have to get up early tomorrow for 9th grade orinetation since school is starting in less then a week and I still haven't wrote my essay!!! :dance::D

Thanks for the feedback ! :whistle:

Edited by layer
FootbaG
Link to comment
Share on other sites

Very nice script.

Maybe you can add the current temperatures also  :whistle:

And this is the site that the forecast extension from firefox use...

http://home.accuweather.com/index.asp?partner=accuweather

<{POST_SNAPBACK}>

Thanks ! :dance: Temperatures... Jeez, how could I have forgotten, will be added in next version :dance:

I don't understand what you mean about the extension for FrieFox, could you or someone explain ? Cheers.

FootbaG
Link to comment
Share on other sites

I may actually use this script, seems very handy to toss onto my desktop. (Maryland dopplar of course)

<{POST_SNAPBACK}>

Yea, it's been on my desktop ever since the last blizzard we had here... I remeber I wrote the dirtiest GUI ever :whistle: I never knew about the Adlib functions so I had a hotkey to exit... Now... It's a lot more cleaner and efficient. I've been adding little things here and there.

Thanks for the feedback :dance:

FootbaG
Link to comment
Share on other sites

Added:

-Temperatures

-A menu, that has no function to it, but will next release

-Since there were quite a few pictures, I created a directory in the temp directory to save some lines of code... And it deletes the WeatherMaps folder when the program exits :dance:

Post one has the updated code... I know the menu doesn't work, it's not supposed to because I didn't write the 800x600 res code yet :whistle: But that's next on my list, so hold your hoarses :dance:

Edited by layer
FootbaG
Link to comment
Share on other sites

I love the concept of the program itself, but is there any particular reason for the dual GUI windows? Plus the buttons are about five times higher than they need to be. You could just put them in the top window right under the picture, and then you can get rid of that complicated docking stuff. Quick example:

Dim $pic = 1, $BS_FLAT = 0x8000

;This is smaller than 800x600, so you should have no troubles using that resolution
$gui1 =       GUICreate("Weather Maps", 700, 515, (@DesktopWidth - 750) / 2, 50)
DirCreate(@TempDir & "\WeatherMaps")
InetGet("http://image.weather.com/web/radar/us_nyc_closeradar_large_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
$echo =       GUICtrlCreatePic(@TempDir & "\WeatherMaps\dopplar.jpg", 0, 0, 700, 485)
$dopplar =    GUICtrlCreateButton("Doppler Radar", 0, 490, 100, 20, $BS_FLAT)
$trops =      GUICtrlCreateButton("Tropics", 105, 490, 100, 20, $BS_FLAT)
$lightning =  GUICtrlCreateButton("Lightning", 210, 490, 100, 20, $BS_FLAT)
$24rainfall = GUICtrlCreateButton("Predicted Rainfall", 315, 490, 100, 20, $BS_FLAT)
$drought =    GUICtrlCreateButton("Drought Severity", 420, 490, 100, 20, $BS_FLAT)
$temps =      GUICtrlCreateButton("Temperatures", 525, 490, 100, 20, $BS_FLAT)
;Had some extra room so I stuck this in, could be used for many things
$opt =        GUICtrlCreateButton("Options...", 630, 490, 70, 20, $BS_FLAT)

GUISetState(@SW_SHOW, $gui1)
AdlibEnable("_GetEcho", 30000)

While 1
   $get = GUIGetMsg()
   Select
      Case $get = -3
         Exit
      Case $get = $dopplar
         $pic = 1
         _GetEcho()
      Case $get = $trops
         $pic = 2
         _GetEcho()
      Case $get = $lightning
         $pic = 3
         _GetEcho()
      Case $get = $24rainfall
         $pic = 4
         _GetEcho()
      Case $get = $drought
         $pic = 5
         _GetEcho()
      Case $get = $temps
         $pic = 6
         _GetEcho()
      Case $get = $opt
        ;Do option-related stuff here
   EndSelect
WEnd

Func _GetEcho()
   If $pic = 1 Then
      InetGet("http://image.weather.com/web/radar/us_nyc_closeradar_large_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
      $name = "\dopplar.jpg"
   ElseIf $pic = 2 Then
      InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", @TempDir & "\WeatherMaps\trops.jpg", 1, 0)
      $name = "\trops.jpg"
   ElseIf $pic = 3 Then
      InetGet("http://image.weather.com/images/maps/severe/map_light_ltst_4namus_enus_600x405.jpg", @TempDir & "\WeatherMaps\lightning.jpg", 1, 0)
      $name = "\lightning.jpg"
   ElseIf $pic = 4 Then
      InetGet("http://image.weather.com/web/maps/radar/regions/us_rainfall_est_yesterday_600_en.jpg", @TempDir & "\WeatherMaps\24rainfall.jpg", 1, 0)
      $name = "\24rainfall.jpg"
   ElseIf $pic = 5 Then
      InetGet("http://image.weather.com/images/maps/current/palmer_drought_720x486.jpg", @TempDir & "\WeatherMaps\drought.jpg", 1, 0)
      $name = "\drought.jpg"
  ElseIf $pic = 6 Then
      InetGet("http://image.weather.com/images/maps/current/acttemp_600x405.jpg", @TempDir & "\WeatherMaps\temps.jpg", 1, 0)
      $name = "\temps.jpg"
   EndIf
   GUICtrlSetImage($echo, @TempDir & "\WeatherMaps\" & $name)
EndFunc;==>_GetEcho

Func OnAutoItExit()
   AdlibDisable()
   GUIDelete($gui1)
   DirRemove(@TempDir & "\WeatherMaps\", 1)
EndFunc;==>OnAutoItExit

Incidentally, what is $BS_FLAT supposed to do? It makes no difference from the default style on my machine.

Edited by Sokko
Link to comment
Share on other sites

@Sokko,

I completley agree with you... I'm changing my code to that, it shortens it up, makes it look neater :dance:

BTW, I don't know if this is true... But the $BS_FLAT doesn't have any affect on the XP theme, at least that's what I remeber. But on the classic theme, it shows which button was last clicked... Maybe this should be in the helpfile ? But only if it's true.

I'll be making the 800x600 version probably tonight :whistle:EDIT: Ohhh... The new version already fits on 800x600, but I'm still going to make it smaller... Because it barley fits :dance:

Cheers

Edited by layer
FootbaG
Link to comment
Share on other sites

Whoah, thanks! It was only a suggestion. :dance:

BTW, I don't know if this is true... But the $BS_FLAT doesn't have any affect on the XP theme, at least that's what I remeber. But on the classic theme, it shows which button was last clicked...

The default styles on both the XP and Classic theme show which button was last clicked (though admittedly it's very subtle in Classic). I just tried switching to Classic, and $BS_FLAT does indeed make the button look "flat". It's basically nothing more than a thin border with the text inside it, and when you click it the text moves but nothing else does.

EDIT: You left my comments in there. :whistle:

Edited by Sokko
Link to comment
Share on other sites

The program is wonderful, just what I needed.

Is it possible to add a function to the script that detects when the computer is connected to the internet, so that it doesn't try and download the pictures when you're offline? A progress bar when it is downloading would be a great addition as well.

Just a few suggestions to make this great program better.

Link to comment
Share on other sites

The program is wonderful, just what I needed.

Is it possible to add a function to the script that detects when the computer is connected to the internet, so that it doesn't try and download the pictures when you're offline? A progress bar when it is downloading would be a great addition as well.

Just a few suggestions to make this great program better.

<{POST_SNAPBACK}>

Hmm... I think that can be done.. I remeber an example to show if you were connected to the internet or not, but cannot find it... Does anyone know where that was ?

Cheers :whistle:

FootbaG
Link to comment
Share on other sites

Have been trying to make the progress bar work with the regular ProgressOn() functions. The bar comes up, but doesn't move.

<snipped>
ProgressOn("Weather Maps", "Loading...", "Loading...", 640, 480, 16)
$dopplarsize = InetGetSize("http://image.weather.com/web/radar/us_msp_metroradar_large_usen.jpg")
InetGet("http://image.weather.com/web/radar/us_msp_metroradar_large_usen.jpg", @TempDir & "\WeatherMaps\dopplar.jpg", 1, 0)
$loaded = Int(@InetGetBytesRead / $dopplarsize)
While @InetGetActive = 1
    ProgressSet($loaded, "Loading... " & $loaded & "%")
    If @InetGetBytesRead = $dopplarsize Then ExitLoop
WEnd
ProgressOff()
<snipped>

So the bar comes up, it is obviously downloading the pic since my traffic meter starts going, but the bar doesn't move. Once the download is done, the program functions like it usually does.

Link to comment
Share on other sites

Here is a SLIDE SHOW version because I'm too lazy to click buttons with the mouse...

$gui1 = GUICreate("Dopplar Radar Slide Show", 700, 485, (@DesktopWidth - 750) / 2, 50)
$echo = GUICtrlCreatePic(InetGet("http://image.weather.com/web/radar/us_abq_closeradar_large_usen.jpg", 1, 0), 0, 0, 700, 485)

GUISetState(@SW_SHOW, $gui1)

While 1

  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/forecast/map_wkpln_night1_3ussw_enus_600x405.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/severe/severe_sw_720x486.jpg", 1 ,0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/web/maps/radar/regions/us_rainfall_est_yesterday_600_en.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/current/palmer_drought_720x486.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/current/sw_curtemp_720x486.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/current/acttemp_600x405.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/special/severe_sw_720x486.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/maps/severe/map_light_ltst_4namus_enus_600x405.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/sat/westsat_720x486.jpg", 1, 0))
  Sleep(11111)
  GUICtrlSetImage($echo, InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", 1, 0))
  Sleep(11111)
  ExitLoop
WEnd

GUIDelete($gui1)
FileDelete(1)
EXIT

*EDIT needed to delete the temporary file and cleaned up a bit...

Edited by PerryRaptor
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...