Jump to content

WeatherDesk II GUI weather app


billmez
 Share

Recommended Posts

WeatherDesk II is an enhanced version of weather desk mod of the original advanced dopplar code by Layer.

The available forecasts have been greatly enhanced and the code (especially conditionals) has been mostly rewriten, taking advantage of selects and functions.

The zip file contains the compiled app WeatherDesk2.exe, the source code WeatherDesk2.Au3, and an icon.

:lmao: Enjoy,

billmez

weatherdesk2.zip

Link to comment
Share on other sites

a nice app, but as a non-american not very usefull for me... ;-(

could you include europe???

thx

Sorry about the US only. The world is a big place to include in a small weather app.

You can take the source code and plug in the URLs to weather.com european forecast graphis in the categories you want. You can find the maps here: http://www.weather.com/maps/geography/euro...ndex_large.html. Right click on the map image you want and copy the URL from the properties.

Link to comment
Share on other sites

  • 2 months later...

I have modified it to save your last region choice to the registry, then when you re-run it it will start off from that regions local surface weather. Below code is link to download, and an icon I have made for it. I know the icon was thrown together in about 30 seconds, I am planning on making a better one.

;========================================================================
; Original code by layer
; Modified by billmez to add menu and selections for regional forecasts
; and various enhancements documented in code below.
; Happy 2006 to all
;
; Modified by Onoitsu2 to allow saving and recovery of last region used,
; and auto loads Local Surface Weather if you have a region selected,
; (region not being US National that is...)
;========================================================================

#include <GuiConstants.au3>
#NoTrayIcon 

; Check for program already running
$g_szVersion = "Weather 1.0"
If WinExists($g_szVersion) Then Exit; It's already running
AutoItWinSetTitle($g_szVersion)

Dim $pic = 1; $BS_FLAT = 0x8000
Dim $loc = "us"
Dim $LastPic = 1
Dim $sat
Dim $refr = 300000; milliseconds to refresh (5 min. - see note below)

$gui1 = GUICreate("Weather Desk", 600, 450, -1, -1, $WS_CAPTION + $WS_SYSMENU + $WS_MINIMIZEBOX + $WS_VISIBLE)

; Test for active Internet connection with Ping
$InetActive = Ping("www.google.com")
If Not $InetActive > 0 Then
MsgBox(4112, "Connection Not Found!", "You must be connected to the Internet" & @CRLF & "to use this program")
Exit
EndIf

; Create Forecast Menu
$selectmenu = GUICtrlCreateMenu("Select Forecast Region",-1,1)  
; Menu select items place in array to more easily facilitate selecting/deselecting
    Dim $selectitem[10] = [GUICtrlCreateMenuitem ("US National",$selectmenu), GUICtrlCreateMenuitem ("North East",$selectmenu), GUICtrlCreateMenuitem ("East Central",$selectmenu), GUICtrlCreateMenuitem ("South East",$selectmenu), GUICtrlCreateMenuitem ("North Central",$selectmenu), GUICtrlCreateMenuitem ("Central",$selectmenu), GUICtrlCreateMenuitem ("South Central",$selectmenu), GUICtrlCreateMenuitem ("North West",$selectmenu), GUICtrlCreateMenuitem ("West Central",$selectmenu), GUICtrlCreateMenuitem ("South West",$selectmenu)]
    
; Set US National as default selected   
Global $default_region = RegRead("HKEY_CURRENT_USER\Software\WeatherDesk","DefaultRegion")
If $default_region = 0 OR $default_region = "" Then
$default_region = 0
GUICtrlSetState($selectitem[0],$GUI_CHECKED)
Else
GUICtrlSetState($selectitem[$default_region],$GUI_CHECKED)
$loc = RegRead("HKEY_CURRENT_USER\Software\WeatherDesk","DefaultRegionAb")
$LastPic = 3
EndIf

; Select Menu Array Assignments
;$selectitem[0] = "US National" 
;$selectitem[1] = "North East"
;$selectitem[2] = "East Central"
;$selectitem[3] = "South East"
;$selectitem[4] = "North Central"
;$selectitem[5] = "Central"
;$selectitem[6] = "South Central"
;$selectitem[7] = "North West"
;$selectitem[8] = "West Central"
;$selectitem[9] = "South West"
    
; create menu items to display current selection
;~ $region = GUICtrlCreateMenu("")
;~ $display = GUICtrlCreateMenu("")


DirCreate(@TempDir & "\WeatherMaps")
If $default_region = 0 Then
    $region = GUICtrlCreateMenu("Currently US National")
    $display = GUICtrlCreateMenu("Doppler Radar")
InetGet("http://image.weather.com/web/radar/us_radar_plus_usen.jpg", @TempDir & "\WeatherMaps\pic1.jpg", 1, 0)
Else
    $title = GUICtrlRead($selectitem[$default_region],1)
    $region = GUICtrlCreateMenu("Currently " & $title[0])
    $display = GUICtrlCreateMenu("Local Surface Weather")
InetGet("http://image.weather.com/images/maps/current/cur_" & $loc & "_720x486.jpg", @TempDir & "\WeatherMaps\pic1.jpg", 1, 0)
EndIf
$Button1 =  GUICtrlCreatePic(@TempDir & "\WeatherMaps\pic1.jpg", 0, 0, 600, 405)
$Button2 =  GUICtrlCreateButton("US Radar", 0, 408, 75, 20, $BS_FLAT)
$Button3 =  GUICtrlCreateButton("US Satelite", 75, 408, 75, 20, $BS_FLAT)
$Button4 =  GUICtrlCreateButton("Forecast", 150, 408, 75, 20, $BS_FLAT)
$Button5 =  GUICtrlCreateButton("Temperatures", 225, 408, 75, 20, $BS_FLAT)
$Button6 =  GUICtrlCreateButton("Current Weather", 300, 408, 85, 20, $BS_FLAT)
$Button7 =  GUICtrlCreateButton("Tropics", 385, 408, 70, 20, $BS_FLAT)
$Button8 =  GUICtrlCreateButton("Severe", 455, 408, 75, 20, $BS_FLAT)
$Button9 =  GUICtrlCreateButton("Drought", 530, 408, 70, 20, $BS_FLAT)

GUISetState(@SW_SHOW, $gui1)

; Even under the most severe conditions the NWS only updates doppler radar sweeps ever 3 minutes
; because it takes that long to complete a scan of the elevations and angles. This script would need
; direct access to NWS radar feeds to be updated even this frequently. TWC probably only updates every
; 10-15 minutes so setting a refresh time of less than 5 minutes is unnecessary. Click the button
; again to update inbetween auto refreshes.
;
; Changed AdlibEnable("_GetEcho", 180000) to a function so it can update the refresh times whenever 
; a different region is selected. Added a variable $refr to set the refresh time

_ReLoad()
$init = 1
While 1
   $get = GUIGetMsg()
;~  MsgBox(0,"","before of do")
   While $init
   Select
   Case $default_region = 0
       $get = 4
   Case $default_region = 1
       $get = 5
   Case $default_region = 2
       $get = 6
   Case $default_region = 3
       $get = 7
   Case $default_region = 4
       $get = 8
   Case $default_region = 5
       $get = 9
   Case $default_region = 6
       $get = 10
   Case $default_region = 7
       $get = 11
   Case $default_region = 8
       $get = 12
   Case $default_region = 9
       $get = 13
   EndSelect
;~  _GetEcho()
   $init = 0
   WEnd
;~  MsgBox(0,"","after do")
   Select
    Case $get = $selectitem[0]
       $default_region = 0
       $loc = "us"
       _UnCheck()
       GUICtrlSetState($selectitem[0],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently US National")
       _SetButtons("nat")
      ; setting $pic to LastPic and calling GetEcho from the menu selctions will
      ; force an update with the same button selection when a different region
      ; is selected.
       $pic = $LastPic
       _GetEcho()
    
    ; selection regions set by variable below for each forecast type.
    Case $get = $selectitem[1]  
       $default_region = 1
       $loc = "ne"
       $sat = "northeast"
       $prec = "ne"
       $sev = "ne"
       $rad = "ne"
       _UnCheck()
       GUICtrlSetState($selectitem[1],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently North East")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[2]
       $default_region = 2
       $loc = "ec"
       $sat = "east_cen"
       $prec = "ecen"
       $sev = "ec"
       $rad = "ec"
       _UnCheck()
       GUICtrlSetState($selectitem[2],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently East Central")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[3]
       $default_region = 3
       $loc = "se"
       $sat = "southeast"
       $prec = "se"
       $sev = "se"
       $rad = "se"
       _UnCheck()
       GUICtrlSetState($selectitem[3],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently South East")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[4]
       $default_region = 4
       $loc = "nc"
       $sat = "n_central"
       $prec = "ncen"
       $sev = "nc"
       $rad = "nc"
       _UnCheck()
       GUICtrlSetState($selectitem[4],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently North Central")
       _SetButtons("reg") 
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[5]
       $default_region = 5
       $loc = "cen"
       $sat = "central"
       $prec = "cen"
       $sev = "cn"
       $rad = "cn"
       _UnCheck()
       GUICtrlSetState($selectitem[5],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently Central")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[6]
       $default_region = 6
       $loc = "sc"
       $sat = "s_central"
       $prec = "scen"
       $sev = "sc"
       $rad = "sc" 
       _UnCheck()
       GUICtrlSetState($selectitem[6],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently South Central")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[7]
       $default_region = 7
       $loc = "nw"
       $sat = "northwest"
       $prec = "nw"
       $sev = "nw"
       $rad = "nw"
       _UnCheck()
       GUICtrlSetState($selectitem[7],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently North West")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[8]
       $default_region = 8
       $loc = "wc"
       $sat = "west_cen"
       $prec = "wcen"
       $sev = "wc"
       $rad = "wc"
       _UnCheck()
       GUICtrlSetState($selectitem[8],$GUI_CHECKED)
       GUICtrlSetData($region,"Currently West Central")
       _SetButtons("reg")
       $pic = $LastPic
       _GetEcho()
    Case $get = $selectitem[9]
        $default_region = 9
        $loc = "sw"
        $sat = "southwest"
        $prec = "sw"
        $sev = "sw"
        $rad = "sw"
        _UnCheck()
        GUICtrlSetState($selectitem[9],$GUI_CHECKED)
        GUICtrlSetData($region,"Currently South West")
        _SetButtons("reg")
        $pic = $LastPic
       _GetEcho()
    Case $get = -3
        Exit
    Case $get = $Button2
        $pic = 1
        _GetEcho()
    Case $get = $Button3
        $pic = 2
        _GetEcho()
    Case $get = $Button4
        $pic = 3
        _GetEcho()
    Case $get = $Button5
        $pic = 4
        _GetEcho()
    Case $get = $Button6
        $pic = 5
        _GetEcho()
    Case $get = $Button7
        $pic = 6
        _GetEcho()
    Case $get = $Button8
        $pic = 7
        _GetEcho()
    Case $get = $Button9
        $pic = 8
        _GetEcho()
    EndSelect
    $LastPic = $pic
WEnd

Func _GetEcho()
    If $pic = 1 Then
      InetGet("http://image.weather.com/web/radar/us_radar_plus_usen.jpg", @TempDir & "\WeatherMaps\pic1.jpg", 1, 0)
      $name = "\pic1.jpg"
      GUICtrlSetData($display,"US Doppler Radar")
      _ReLoad()
    ElseIf $pic = 2 Then
      InetGet("http://image.weather.com/images/sat/ussat_600x405.jpg", @TempDir & "\WeatherMaps\pic2.jpg", 1, 0)
      $name = "\pic2.jpg"
      GUICtrlSetData($display,"US Infrared Satelite")
      _ReLoad()
    ElseIf $pic = 3 Then
      If $loc = "us" Then
      InetGet("http://image.weather.com/web/forecast/us_wxhi1_large_usen_600.jpg", @TempDir & "\WeatherMaps\pic3.jpg", 1, 0)
      GUICtrlSetData($display,"Forecast")
      Else
      InetGet("http://image.weather.com/images/maps/current/cur_" & $loc & "_720x486.jpg", @TempDir & "\WeatherMaps\pic3.jpg", 1, 0)
      GUICtrlSetData($display,"Local Surface Weather")
      EndIf
      $name = "\pic3.jpg"  
      _ReLoad()
    ElseIf $pic = 4 Then
      If $loc = "us" Then
      InetGet("http://image.weather.com/images/maps/current/acttemp_600x405.jpg", @TempDir & "\WeatherMaps\pic4.jpg", 1, 0)
      GUICtrlSetData($display,"Temperatures")
      Else
      InetGet("http://image.weather.com/images/maps/current/" & $loc & "_curtemp_720x486.jpg", @TempDir & "\WeatherMaps\pic4.jpg", 1, 0)
      GUICtrlSetData($display,"Local Temperatures")
      EndIf
      $name = "\pic4.jpg"  
      _ReLoad()
    ElseIf $pic = 5 Then
      If $loc = "us" Then
      InetGet("http://image.weather.com/images/maps/current/curwx_600x405.jpg", @TempDir & "\WeatherMaps\pic5.jpg", 1, 0)
      GUICtrlSetData($display,"Surface Weather")
      Else
      InetGet("http://image.weather.com/images/maps/forecast/" & $prec & "_precfcst_600x405.jpg", @TempDir & "\WeatherMaps\pic5.jpg", 1, 0)
      GUICtrlSetData($display,"Local Precipitation")
      EndIf
      $name = "\pic5.jpg" 
      _ReLoad()
    ElseIf $pic = 6 Then
      If $loc = "us" Then
      InetGet("http://image.weather.com/images/sat/tropsat_600x405.jpg", @TempDir & "\WeatherMaps\pic6.jpg", 1, 0)
      GUICtrlSetData($display,"Tropical Satelite")
      Else
      InetGet("http://image.weather.com/images/maps/special/severe_" & $sev & "_720x486.jpg", @TempDir & "\WeatherMaps\pic6.jpg", 1, 0)
      GUICtrlSetData($display,"Local Severe Weather")
      EndIf
      $name = "\pic6.jpg"
      _ReLoad()
    ElseIf $pic = 7 Then
      If $loc = "us" Then
      InetGet("http://image.weather.com/images/maps/special/severe_us_600x405.jpg", @TempDir & "\WeatherMaps\pic7.jpg", 1, 0)
      GUICtrlSetData($display,"Severe Weather")
      Else
      InetGet("http://image.weather.com/web/radar/us_" & $rad & "_9regradar_large_usen.jpg", @TempDir & "\WeatherMaps\pic7.jpg", 1, 0)
      GUICtrlSetData($display,"Local Doppler Radar")
      EndIf
      $name = "\pic7.jpg"
      _ReLoad()
    ElseIf $pic = 8 Then
      If $loc = "us" Then
      InetGet("http://image.weather.com/images/maps/current/palmer_drought_720x486.jpg", @TempDir & "\WeatherMaps\pic8.jpg", 1, 0)
      GUICtrlSetData($display,"Drought Conditions")
      Else
      InetGet("http://image.weather.com/images/sat/regions/" & $sat & "_sat_720x486.jpg", @TempDir & "\WeatherMaps\pic8.jpg", 1, 0)
      GUICtrlSetData($display,"Local Infrared Satelite")
      EndIf
      $name = "\pic8.jpg"
      _ReLoad()
   EndIf
   
   GUICtrlSetImage($Button1, @TempDir & "\WeatherMaps\" & $name)
EndFunc;==>_GetEcho

Func OnAutoItExit()
   AdlibDisable()
   If NOT ($default_region = "") Then
   RegWrite("HKEY_CURRENT_USER\Software\WeatherDesk","DefaultRegion","REG_SZ",$default_region)
   RegWrite("HKEY_CURRENT_USER\Software\WeatherDesk","DefaultRegionAb","REG_SZ",$loc)
   Else
   RegWrite("HKEY_CURRENT_USER\Software\WeatherDesk","DefaultRegion","REG_SZ",0)
   RegWrite("HKEY_CURRENT_USER\Software\WeatherDesk","DefaultRegionAb","REG_SZ","us")
   EndIf
   If $gui1 Then
   GUIDelete($gui1)
   EndIf
   DirRemove(@TempDir & "\WeatherMaps\", 1)
EndFunc;==>OnAutoItExit

; Uncheck all menu items before checking current selection
Func _UnCheck()
    For $i = 0 to 9
        GUICtrlSetState($selectitem[$i],$GUI_UnCHECKED)
        Next
    EndFunc
    
; Set button display for either regional or national forecasts
Func _SetButtons($buttons)
    If $buttons = "reg" Then
        GUICtrlSetData($Button4, "Current")
        GUICtrlSetData($Button6, "Precipitation")
        GUICtrlSetData($Button7, "Severe")
        GUICtrlSetData($Button8, "Radar")
        GUICtrlSetData($Button9, "Satelite")
    Else
        $buttons = "nat"
        GUICtrlSetData($Button4, "Forecast")
        GUICtrlSetData($Button6, "Current Weather")
        GUICtrlSetData($Button7, "Tropics")
        GUICtrlSetData($Button8, "Severe")
        GUICtrlSetData($Button9, "Drought")
    EndIf
EndFunc
Func _ReLoad()
    AdlibDisable()
    AdlibEnable("_GetEcho", $refr)
EndFunc

weatherdesk.au3

weatherdesk.ico

Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

Link to comment
Share on other sites

  • 2 months later...

Forgive me if it may appear I'm resurrecting a very old thread.

I love the old "advanced dopplar" script layer created quite a while back now, and I am glad to see it evolved into this. As for the icon, I've been doing some basic icon work recently, and I thought I might upload my generic library.

In essence, the icon attached is actually 9 icons in one, each with the usual sizes. The icons represent the usual weather conditions, sunny, cloudy, rain, storm, and the like. Application of the icon would either involve the creation of a shortcut and applying the icon from there, or it is possible to refer to the icon directly from the program.

If anyone wants them, I also have the 9 icons in their own files, with all the standard sizes and color sets, available.

Hope this program sees more improvement!

-Dice

Edit: Sorry if it looked like I triple posted.... my connection wasn't cooperating with the file upload. :D

Edit: corrected typo :wacko:

Weather.zip

Edited by Dicemaster Slayer
Link to comment
Share on other sites

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...