Jump to content

Weather Desktop Widget


Damein
 Share

Recommended Posts

Alright, I have updated the script to pull the correct data now.

Here is the updated UDF (I changed the StringRegExp and I also removed the Precipitation part)

WeatherUDF.au3

And here is the new example

Widget.au3

I decided to expand this program a little, so look for an update in the near future :D

Let me know if you guys have anymore problems.

This is still being created (The GUI) so some of the labels will be out of alignment ($OverViewTime & $OverViewStatus) if you get an out-of-aligned label (IE, not centered) then please do the following

  • Go to Weather.com
  • Search for weather for your zip code you used
  • Look at the labels "Right Now", "Tonight", "Light Rain", "Snowing" etc. etc.
  • Tell me exactly which ones are present
This will let me create another ElseIf statement to do the correct aligning of the labels so they look nice.

Thanks, and enjoy!

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Eh, I guess I could just update teh first post. You're welcome :D

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Here ya go. :oops:

#include <Array.au3>

InetGet("http://xml.weather.com/weather/local/USPA0824?cc=*&unit=f&dayf=10", @TempDir & "temp.xml")
$open = FileOpen(@TempDir & "temp.xml")
$read = FileRead($open)
$current = StringRegExp($read, "(?siU).*<locale>(.*)</locale>.*<ut>(.*)</ut>.*<ud>(.*)</ud>.*<us>(.*)</us>.*<up>(.*)</up>.*<ur>(.*)</ur>.*<loc id=""(.*)"">.*<dnam>(.*)</dnam>.*<tm>(.*)</tm>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>(.*)</zone>.*<cc>.*<lsup>(.*)</lsup>.*<obst>(.*)</obst>.*<tmp>(.*)</tmp>.*<flik>(.*)</flik>.*<t>(.*)</t>.*<icon>(.*)</icon>.*<bar>.*<r>(.*)</r>.*<d>(.*)</d>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<hmid>(.*)</hmid>.*<vis>(.*)</vis>.*<uv>.*<i>(.*)</i>.*<t>(.*)</t>.*<dewp>(.*)</dewp>.*<moon>.*<icon>(.*)</icon>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday = StringRegExp($read, "(?siU)<dayf>.*<lsup>(.*)</lsup>.*<day d=""0"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<d>(.*)</d>.*<t>(.*)</t>.*<bt>(.*)</bt>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*", 1)
$_forecasttoday1 = StringRegExp($read, "(?siU)<day d=""1"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday2 = StringRegExp($read, "(?siU)<day d=""2"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday3 = StringRegExp($read, "(?siU)<day d=""3"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday4 = StringRegExp($read, "(?siU)<day d=""4"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday5 = StringRegExp($read, "(?siU)<day d=""5"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday6 = StringRegExp($read, "(?siU)<day d=""6"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday7 = StringRegExp($read, "(?siU)<day d=""7"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday8 = StringRegExp($read, "(?siU)<day d=""8"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)
$_forecasttoday9 = StringRegExp($read, "(?siU)<day d=""9"" t=""(.*)"" dt=""(.*)"".*<hi>(.*)</hi>.*<low>(.*)</low>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<part p=""d"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*<hmid>(.*)</hmid>.*<part p=""n"">.*<icon>(.*)</icon>.*<t>(.*)</t>.*<wind>.*<s>(.*)</s>.*<gust>(.*)</gust>.*<t>(.*)</t>.*<ppcp>(.*)</ppcp>.*", 1)

Dim $current2[UBound($current)][2]
For $i = 1 To UBound($current) - 1
$current2[$i][0] = $current[$i]
Next
Dim $forecasttoday[UBound($_forecasttoday)][2]
For $i = 1 To UBound($_forecasttoday) - 1
$forecasttoday[$i][0] = $_forecasttoday[$i]
Next
Dim $forecasttoday1[UBound($_forecasttoday1)][10]
For $i = 1 To UBound($_forecasttoday1) - 1
$forecasttoday1[$i][1] = $_forecasttoday1[$i]
$forecasttoday1[$i][2] = $_forecasttoday2[$i]
$forecasttoday1[$i][3] = $_forecasttoday3[$i]
$forecasttoday1[$i][4] = $_forecasttoday4[$i]
$forecasttoday1[$i][5] = $_forecasttoday5[$i]
$forecasttoday1[$i][6] = $_forecasttoday6[$i]
$forecasttoday1[$i][7] = $_forecasttoday7[$i]
$forecasttoday1[$i][8] = $_forecasttoday8[$i]
$forecasttoday1[$i][9] = $_forecasttoday9[$i]
Next
$current2[1][1] = "f/c"
$current2[2][1] = "mi/km"
$current2[3][1] = "mph/kph"
$current2[4][1] = "in"
$current2[7][1] = "location"
$current2[8][1] = "time"
$current2[9][1] = "latitude"
$current2[10][1] = "longitude"
$current2[11][1] = "sunrise"
$current2[12][1] = "sunset"
$current2[13][1] = "zone"
$current2[14][1] = "update"
$current2[16][1] = "tempcurrent"
$current2[17][1] = "feels like"
$current2[18][1] = "conditions"
$current2[19][1] = "icon"
$current2[20][1] = "pressure"
$current2[21][1] = "pressure condition"
$current2[22][1] = "wind"
$current2[23][1] = "wind gust"
$current2[24][1] = "wind degree"
$current2[25][1] = "wind direction"
$current2[26][1] = "humidity"
$current2[27][1] = "visibility"
$current2[28][1] = "uv index"
$current2[29][1] = "uv text"
$current2[30][1] = "dewpoint"
$current2[31][1] = "moon icon"
$current2[32][1] = "moon phase"
$current2[33][1] = "precipitation"
$forecasttoday[0][1] = "update time"
$forecasttoday[1][1] = "day1"
$forecasttoday[2][1] = "date"
$forecasttoday[3][1] = "temp1"
$forecasttoday[4][1] = "weather night temp"
$forecasttoday[5][1] = "sunrise"
$forecasttoday[6][1] = "sunset"
$forecasttoday[7][1] = "weathericon1"
$forecasttoday[8][1] = "weather desc 1"
$forecasttoday[16][1] = "weather night icon"
$forecasttoday[17][1] = "weather night desc"
$forecasttoday[21][1] = "wind direction"

$forecasttoday1[0][0] = "day"
$forecasttoday1[1][0] = "date"
$forecasttoday1[2][0] = "high"
$forecasttoday1[3][0] = "low"
$forecasttoday1[4][0] = "sunrise"
$forecasttoday1[5][0] = "sunset"
$forecasttoday1[6][0] = "icon"
$forecasttoday1[7][0] = "text"
$forecasttoday1[8][0] = "windspeed"
$forecasttoday1[9][0] = "gust"
$forecasttoday1[10][0] = "direction"
$forecasttoday1[11][0] = "chance of precipitation"
$forecasttoday1[12][0] = "humidity"
$forecasttoday1[13][0] = "night icon"
$forecasttoday1[14][0] = "night text"
$forecasttoday1[15][0] = "night windspeed"
$forecasttoday1[16][0] = "night gust"
$forecasttoday1[17][0] = "night direction"
$forecasttoday1[18][0] = "night precipitation"

_ArrayDisplay($current2)
_ArrayDisplay($forecasttoday)
_ArrayDisplay($forecasttoday1)

P.S. Excuse the coding, I know it isn't very neat. :D This script downloads the forcasts for current, today & the next 9 days & concatenates descriptions onto them & displays them. Have fun! :rip:

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Alright, so once again I've decided to give an update on this. I pretty much completly forgot about this until someone PM'd me about it ^^;

So it looks like Zip-Codes.com changed their format, so I had to update that. Also, Weather.com changed their tags for some things, so that was fixed.

I also decided to add a new way to input the statuses (Sunny, Thunderstorms, etc. etc.) With this new one, I won't have to ever touch the code to add anything, its all done via an INI.

Since I did it this way (I forgot to save my .txt file with all the weather.com statuses, stupid me) I don't have them all listed so far. SO, if you try and use this and it doesn't have a status, it means its not in the INI. But never fear, its really easy to add a new one!

If you get the error that I just explained, go to Weather.com and type in the zip code you used on the first run of the program. When the weather information comes up look at the listing and see what the status was for the day (Right Now, Tomorrow etc. etc.) When you have located the right one, open the ini file and add it to the bottom of the list.

Here is the setup

Weather Info.zip

[Status]
1=Partly Cloudy
2=Isolated T-Storms
3=Mostly Cloudy
4=Mostly Sunny

[XY]
Partly Cloudy=30,200
Isolated T-Storms=15,200
Mostly Cloudy=30,200
Mostly Sunny=32,200

So if a new one is needed, start at [status] and add a 5=(New Status) and then go to XY and add a (New Status)=32,200 (Or whatever it is you need to align the text with the GUI properly.

If you have any problems, just send me the status you have and I will add it in for you.

Well, here is the updated Widget and UDF, with the INI.

Widget Source:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=Beta testing
#AutoIt3Wrapper_Res_Description=Pulls data from Weather.com
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=RobertSSoftware
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <WinAPI.au3>
#include "WeatherUDF.au3"
#include <array.au3>
Opt("GUIOnEventMode", 1)
Global $Statuses = IniReadSection("Statuses.ini", "Status")
Global $XY = IniReadSection("Statuses.ini", "XY")
Global $ZipCode, $GUI, $hgraphic, $himage, $RightNowGui, $TodayGui, $TonightGui, $TomorrowGui
$ZipCode = InputBox("Zip code", "Please input your zip code")
$ZipCode2 = "http://www.zip-codes.com/zip-code/" & $ZipCode
Global $sSource = BinaryToString(InetRead($ZipCode2))
$City = StringRegExp($sSource,'(?i)(?s)<a href="/city/(.*?)-(.*?).asp',1)
$State = StringRegExp($sSource,'(?i)(?s)<a href="/state(.*?)/(.*?).asp',1)
$Url = 'http://www.weather.com/weather/today/' & $City[1] & '+' & $State[1] & '+' & $Zipcode
Global $h_Desktop_SysListView32
_GetDesktopHandle()
$Width = @DesktopWidth
$Height = @DesktopHeight
_GetOverViewTimes()
    _GetOverViewTemperature()
    _GetOverViewImages()
    _GetOverViewStatus()
_RightNowGUI()
Func _RightNowGUI()
    GuiDelete($RightNowGUI)
    GuiDelete($TodayGUI)
    GuiDelete($TonightGUI)
    GuiDelete($TomorrowGUI)
    $RightNowGUI = GUICreate("", 150, 300, $Width-151, $Height-600, BitOR($WS_POPUP,$WS_BORDER), Default, WinGetHandle(AutoItWinGetTitle()))
    GuiSetFont(13)
    GUICtrlSetDefColor(0xFFFFFF)
    GUISetBkColor(0x000000)
    WinSetTrans($RightNowGUI,"",200)
    GuiSetState()
    GuiCtrlCreateLabel($OverViewTime[1],38,10,200,50)
For $i = 1 To $Statuses[0][0]
  If $Statuses[$i][1] = $OverViewStatus[1] Then
   For $i = 1 To $XY[0][0]
    If $XY[$i][0] = $OverViewStatus[1] Then
     $Split = StringSplit($XY[$i][1],",")
    EndIf
   Next
   GuiCtrlCreateLabel($OverViewStatus[1],$Split[1],$Split[2])
  EndIf
  Next
    GuiCtrlCreateLabel("Temperature",35,230,200,40)
    GuiCtrlCreateLabel($OverViewTemp[1] & "°F",64,250,200,40)
    $ContextMenu = GuiCtrlCreateContextMenu()
    $RightNowItem = GuiCtrlCreateMenuItem($OverViewTime[1], $ContextMenu)
    GUICtrlSetOnEvent($RightNowItem, "_RightNowGUI")
    $TodayItem = GuiCtrlCreateMenuItem($OverViewTime[2], $ContextMenu)
    GUICtrlSetOnEvent($TodayItem, "_TodayGUI")
    $TonightItem = GuiCtrlCreateMenuItem($OverViewTime[3], $ContextMenu)
    GUICtrlSetOnEvent($TonightItem, "_TonightGUI")
    $TomorrowItem = GuiCtrlCreateMenuItem($OverViewTime[4], $ContextMenu)
    GUICtrlSetOnEvent($TomorrowItem, "_TomorrowGUI")
    $RefreshItem = GuiCtrlCreateMenuItem("Refresh", $ContextMenu)
    GUICtrlSetOnEvent($RefreshItem, "_Refresh")
    $ExitItem = GuiCtrlCreateMenuItem("Close", $ContextMenu)
    GUICtrlSetOnEvent($ExitItem, "_Exit")
    DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $RightNowGUI, "hwnd", $h_Desktop_SysListView32)
    _GDIPlus_StartUp()
    $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/Images/Image1.png")
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($RightNowGUI)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 13, 35, 130,160)
EndFunc
Func _TodayGUI()
    GuiDelete($RightNowGUI)
    GuiDelete($TodayGUI)
    GuiDelete($TonightGUI)
    GuiDelete($TomorrowGUI)
    $TodayGUI = GUICreate("", 150, 300, $Width-151, $Height-600, BitOR($WS_POPUP,$WS_BORDER), Default, WinGetHandle(AutoItWinGetTitle()))
    GuiSetFont(13)
    GUICtrlSetDefColor(0xFFFFFF)
    GUISetBkColor(0x000000)
    WinSetTrans($TodayGui,"",200)
     GuiSetState()
For $i = 1 To $Statuses[0][0]
  If $Statuses[$i][1] = $OverViewStatus[2] Then
   For $i = 1 To $XY[0][0]
    If $XY[$i][0] = $OverViewStatus[2] Then
     $Split = StringSplit($XY[$i][1],",")
    EndIf
   Next
   GuiCtrlCreateLabel($OverViewStatus[2],$Split[1],$Split[2])
  EndIf
  Next
If $OverViewTime[2] = "Today" Then
    GuiCtrlCreateLabel($OverViewTime[2], 48,10,200,50)
ElseIf $OverViewTime[2] = "Tonight" Then
GuiCtrlCreateLabel($OverViewTime[2], 45,10,200,50)
Else
MsgBox(0, "Test", "Error")
EndIf
    GuiCtrlCreateLabel("Temperature",35,230,200,40)
    GuiCtrlCreateLabel($OverViewTemp[2] & "°F",64,250,200,40)
     $ContextMenu = GuiCtrlCreateContextMenu()
    $RightNowItem = GuiCtrlCreateMenuItem($OverViewTime[1], $ContextMenu)
    GUICtrlSetOnEvent($RightNowItem, "_RightNowGUI")
    $TodayItem = GuiCtrlCreateMenuItem($OverViewTime[2], $ContextMenu)
    GUICtrlSetOnEvent($TodayItem, "_TodayGUI")
    $TonightItem = GuiCtrlCreateMenuItem($OverViewTime[3], $ContextMenu)
    GUICtrlSetOnEvent($TonightItem, "_TonightGUI")
    $TomorrowItem = GuiCtrlCreateMenuItem($OverViewTime[4], $ContextMenu)
    GUICtrlSetOnEvent($TomorrowItem, "_TomorrowGUI")
    $RefreshItem = GuiCtrlCreateMenuItem("Refresh", $ContextMenu)
    GUICtrlSetOnEvent($RefreshItem, "_Refresh")
    $ExitItem = GuiCtrlCreateMenuItem("Close", $ContextMenu)
    GUICtrlSetOnEvent($ExitItem, "_Exit")
    DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $RightNowGUI, "hwnd", $h_Desktop_SysListView32)
     _GDIPlus_StartUp()
    $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/Images/Image2.png")
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($TodayGUI)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 13, 35, 130,160)
EndFunc
Func _TonightGUI()
    GuiDelete($RightNowGUI)
    GuiDelete($TodayGUI)
    GuiDelete($TonightGUI)
    GuiDelete($TomorrowGUI)
    $TonightGUI = GUICreate("", 150, 300, $Width-151, $Height-600, BitOR($WS_POPUP,$WS_BORDER), Default, WinGetHandle(AutoItWinGetTitle()))
    GuiSetFont(13)
    GUICtrlSetDefColor(0xFFFFFF)
    GUISetBkColor(0x000000)
    WinSetTrans($TonightGui,"",200)
GuiSetState()
For $i = 1 To $Statuses[0][0]
  If $Statuses[$i][1] = $OverViewStatus[3] Then
   For $i = 1 To $XY[0][0]
    If $XY[$i][0] = $OverViewStatus[3] Then
     $Split = StringSplit($XY[$i][1],",")
    EndIf
   Next
   GuiCtrlCreateLabel($OverViewStatus[3],$Split[1],$Split[2])
  EndIf
  Next
If $OverViewTime[3] = "Tonight" Then
    GuiCtrlCreateLabel($OverViewTime[3], 48,10,200,50)
ElseIf $OverViewTime[3] = "Tomorrow" Then
GuiCtrlCreateLabel($OverViewTime[3], 43,10,200,50)
Else
MsgBox(0, "Test", "Error")
EndIf
    GuiCtrlCreateLabel("Temperature",35,230,200,40)
    GuiCtrlCreateLabel($OverViewTemp[3] & "°F",64,250,200,40)
    $ContextMenu = GuiCtrlCreateContextMenu()
    $RightNowItem = GuiCtrlCreateMenuItem($OverViewTime[1], $ContextMenu)
    GUICtrlSetOnEvent($RightNowItem, "_RightNowGUI")
    $TodayItem = GuiCtrlCreateMenuItem($OverViewTime[2], $ContextMenu)
    GUICtrlSetOnEvent($TodayItem, "_TodayGUI")
    $TonightItem = GuiCtrlCreateMenuItem($OverViewTime[3], $ContextMenu)
    GUICtrlSetOnEvent($TonightItem, "_TonightGUI")
    $TomorrowItem = GuiCtrlCreateMenuItem($OverViewTime[4], $ContextMenu)
    GUICtrlSetOnEvent($TomorrowItem, "_TomorrowGUI")
    $RefreshItem = GuiCtrlCreateMenuItem("Refresh", $ContextMenu)
    GUICtrlSetOnEvent($RefreshItem, "_Refresh")
    $ExitItem = GuiCtrlCreateMenuItem("Close", $ContextMenu)
    GUICtrlSetOnEvent($ExitItem, "_Exit")
    DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $RightNowGUI, "hwnd", $h_Desktop_SysListView32)
     _GDIPlus_StartUp()
    $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/Images/Image3.png")
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($TonightGUI)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 13, 35, 130,160)
EndFunc
Func _TomorrowGUI()
    GuiDelete($RightNowGUI)
    GuiDelete($TodayGUI)
    GuiDelete($TonightGUI)
    GuiDelete($TomorrowGUI)
    $TomorrowGUI = GUICreate("", 150, 300, $Width-151, $Height-600, BitOR($WS_POPUP,$WS_BORDER), Default, WinGetHandle(AutoItWinGetTitle()))
    GuiSetFont(13)
    GUICtrlSetDefColor(0xFFFFFF)
    GUISetBkColor(0x000000)
    WinSetTrans($TomorrowGui,"",200)
GuiSetState()
For $i = 1 To $Statuses[0][0]
  If $Statuses[$i][1] = $OverViewStatus[4] Then
   For $i = 1 To $XY[0][0]
    If $XY[$i][0] = $OverViewStatus[4] Then
     $Split = StringSplit($XY[$i][1],",")
    EndIf
   Next
   GuiCtrlCreateLabel($OverViewStatus[4],$Split[1],$Split[2])
  EndIf
  Next
If $OverViewTime[4] = "Tomorrow" Then
    GuiCtrlCreateLabel($OverViewTime[4], 45,10,200,50)
ElseIf $OverViewTime[4] = "Tomorrow Night" Then
GuiCtrlCreateLabel($OverViewTime[4], 22,10,200,50)
EndIf
    GuiCtrlCreateLabel("Temperature",35,230,200,40)
    GuiCtrlCreateLabel($OverViewTemp[4] & "°F",64,250,200,40)
    $ContextMenu = GuiCtrlCreateContextMenu()
    $RightNowItem = GuiCtrlCreateMenuItem($OverViewTime[1], $ContextMenu)
    GUICtrlSetOnEvent($RightNowItem, "_RightNowGUI")
    $TodayItem = GuiCtrlCreateMenuItem($OverViewTime[2], $ContextMenu)
    GUICtrlSetOnEvent($TodayItem, "_TodayGUI")
    $TonightItem = GuiCtrlCreateMenuItem($OverViewTime[3], $ContextMenu)
    GUICtrlSetOnEvent($TonightItem, "_TonightGUI")
    $TomorrowItem = GuiCtrlCreateMenuItem($OverViewTime[4], $ContextMenu)
    GUICtrlSetOnEvent($TomorrowItem, "_TomorrowGUI")
    $RefreshItem = GuiCtrlCreateMenuItem("Refresh", $ContextMenu)
    GUICtrlSetOnEvent($RefreshItem, "_Refresh")
    $ExitItem = GuiCtrlCreateMenuItem("Close", $ContextMenu)
    GUICtrlSetOnEvent($ExitItem, "_Exit")
    DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $RightNowGUI, "hwnd", $h_Desktop_SysListView32)
_GDIPlus_StartUp()
    $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "/Images/Image4.png")
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($TomorrowGUI)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 13, 35, 130,160)
EndFunc
Func _Quit()
    Exit
EndFunc
While 1
    Sleep(10)
WEnd

Func _GetDesktopHandle()
    $h_Desktop_SysListView32 = 0
    Local Const $hDwmApiDll = DllOpen("dwmapi.dll")
    Local $sChkAero = DllStructCreate("int;")
    DllCall($hDwmApiDll, "int", "DwmIsCompositionEnabled", "ptr", DllStructGetPtr($sChkAero))
    Local $aero_on = DllStructGetData($sChkAero, 1)
    If Not $aero_on Then
        $h_Desktop_SysListView32 = WinGetHandle("Program Manager")
        Return 1
    Else
        Local $hCBReg = DllCallbackRegister("_GetDesktopHandle_EnumChildWinProc", "hwnd", "hwnd;lparam")
        If $hCBReg = 0 Then Return SetError(2)
        DllCall("user32.dll", "int", "EnumChildWindows", "hwnd", _WinAPI_GetDesktopWindow(), "ptr", DllCallbackGetPtr($hCBReg), "lparam", 101)
        Local $iErr = @error
        DllCallbackFree($hCBReg)
        If $iErr Then
            Return SetError(3, $iErr, "")
        EndIf
        Return 2
    EndIf
EndFunc
Func _Refresh()
_GetOverViewTimes()
    _GetOverViewTemperature()
    _GetOverViewImages()
    _GetOverViewStatus()
    _RightNowGUI()
EndFunc
Func _Exit()
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()
    Exit
EndFunc

UDF Source:

#include <array.au3>
#Include-Once
Global $OverViewTemp[10], $OverViewImage[5], $OverViewStatus[5], $OverViewTime[5]
Global $Url, $RightNowImage, $TodayImage, $TonightImage, $TomorrowImage
Func _GetOverViewTimes()
Global $sSource = BinaryToString(InetRead($Url))
For $i = 1 To 5
If $i = 1 Then
  $Time1 = StringRegExp($sSource,'(?i)(?s)<span class="twc-forecast-when twc-none">(.*?)</span>',1)
ElseIf $i = 2 Then
  $Time2 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-2 twc-forecast-when">(.*?)</td>',1)
ElseIf $i = 3 Then
  $Time3 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-3 twc-forecast-when">(.*?)</td>',1)
ElseIf $i = 4 Then
  $Time4 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-4 twc-forecast-when">(.*?)</td>',1)
EndIf
Next
For $i = 1 To 4
If $i = 1 Then
$OverViewTime[1] = $Time1[0]
ElseIf $i = 2 Then
$OverViewTime[2] = $Time2[0]
ElseIf $i = 3 Then
$OverViewTime[3] = $Time3[0]
ElseIf $i = 4 Then
$OverViewTime[4] = $Time4[0]
EndIf
Next
EndFunc
Func _GetOverViewTemperature()
Global $sSource = BinaryToString(InetRead($Url))
For $i = 1 To 5
If $i = 1 Then
  $Temp1 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-1 twc-forecast-temperature"><strong>(.*?)&deg',1)
ElseIf $i = 2 Then
  $Temp2 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-2 twc-forecast-temperature"><strong>(.*?)&deg',1)
ElseIf $i = 3 Then
  $Temp3 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-3 twc-forecast-temperature"><strong>(.*?)&deg',1)
ElseIf $i = 4 Then
  $Temp4 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-4 twc-forecast-temperature"><strong>(.*?)&deg',1)
EndIf
Next
For $i = 1 To 4
If $i = 1 Then
$OverViewTemp[1] = $Temp1[0]
ElseIf $i = 2 Then
$OverViewTemp[2] = $Temp2[0]
ElseIf $i = 3 Then
$OverViewTemp[3] = $Temp3[0]
ElseIf $i = 4 Then
$OverViewTemp[4] = $Temp4[0]
EndIf
Next
EndFunc
Func _GetOverViewImages()
Global $sSource = BinaryToString(InetRead($Url))
$Image1 = StringRegExp($sSource, "(?i)<img\ssrc=.+(http.+\.png).*column 1.*-->", 1)
$Image2 = StringRegExp($sSource, "(?i)<img\ssrc=.+(http.+\.png).*column 2.*-->", 1)
$Image3 = StringRegExp($sSource, "(?i)<img\ssrc=.+(http.+\.png).*column 3.*-->", 1)
$Image4 = StringRegExp($sSource, "(?i)<img\ssrc=.+(http.+\.png).*column 4.*-->", 1)
For $i = 1 To 4
If $i = 1 Then
$OverViewImage[1] = $Image1[0]
ElseIf $i = 2 Then
$OverViewImage[2] = $Image2[0]
ElseIf $i = 3 Then
$OverViewImage[3] = $Image3[0]
ElseIf $i = 4 Then
$OverViewImage[4] = $Image4[0]
EndIf
Next
For $i = 1 To 4
If $i = 1 Then
  $RightNowImage = InetGet($OverViewImage[1], @ScriptDir & "\Images\Image1.png")
EndIf
If $i = 2 Then
  $TodayImage = InetGet($OverViewImage[2], @ScriptDir & "\Images\Image2.png")
EndIf
If $i = 3 Then
  $TonightImage = InetGet($OverViewImage[3], @ScriptDir & "\Images\Image3.png")
EndIf
If $i = 4 Then
  $TomorrowImage = InetGet($OverViewImage[4], @ScriptDir & "\Images\Image4.png")
EndIf
Next
EndFunc
Func _GetOverViewStatus()
Global $sSource = BinaryToString(InetRead($Url))
For $i = 1 To 4
If $i = 1 Then
  $Status1Start = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-1(.*?)<!-- Column 1 -->',1)
  $Status1 = StringRegExp($Status1Start[0],'(?i)(?s)alt="(.*?)"',1)
ElseIf $i = 2 Then
  $Status2 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-2 ">(.*?)</td>',1)
ElseIf $i = 3 Then
  $Status3 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-3 ">(.*?)</td>',1)
ElseIf $i = 4 Then
  $Status4 = StringRegExp($sSource,'(?i)(?s)<td class="twc-col-4 ">(.*?)</td>',1)
EndIf
Next
For $i = 1 To 4
If $i = 1 Then
$OverViewStatus[1] = $Status1[0]
ElseIf $i = 2 Then
$OverViewStatus[2] = $Status2[0]
ElseIf $i = 3 Then
$OverViewStatus[3] = $Status3[0]
ElseIf $i = 4 Then
$OverViewStatus[4] = $Status4[0]
EndIf
Next
EndFunc
Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

So I decided to start a Sourceforge on this, from now on I will be updating on there instead of here. If you are looking for any info on it or anything, need help please post there so I can get some recognition on there :oops:

https://sourceforge.net/projects/weatherwidget/

Also, please download the .zip located on there for a few updates (Small bug in the refresh system, also added an icon file for the .exe)

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Hey again. I just wanted to let you guys know, I've done some pretty big updates on this.

I added a auto-refresh ability at the first run of program and some clean-up/added more statuses/alignment fixes.

So check it out, make sure you get version 1.2 and enjoy, and as always I'd love to hear some feed back :oops:

https://sourceforge.net/projects/weatherwidget/

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

  • 2 weeks later...

Just as an FYI, I found out that the Right Now GUI's image was not being updated after first run. Fixed this problem, added a feature for extended info for the selected GUI and also removed the auto-refresh ability for the moment, hope to re-add it when I fix some bugs.

https://sourceforge.net/projects/weatherwidget/

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

I'm receiving an error after putting zip code '71171':

Posted Image

And when I put "whatever" in the input box, there's an array error. Shouldn't it ask me again? Or something :doh:

Anyway nice job ! :bye:

BTW it would be cool if you add Europe there :oops:

Edited by VixinG

[indent=3][/indent]

Link to comment
Share on other sites

I should probably add a empty string error in there. As for the 71171, are you sure you put that in right? Because I just tested it and it worked 100% for me.

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

I'm from Poland so I don't know any zip codes but 71171 because it is easy to remember :oops:

The app is working and not working - 4 of 5 times it didn't work. I also tried with sourceforge .exe version - it loads very slowly and sometimes works, sometimes not :bye:

Best regards!

[indent=3][/indent]

Link to comment
Share on other sites

That's odd... I've never had it not work, lol.

Weird.

Anyone else have problems?

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Does anyone think I should add a item in the context menu to allow to change the zip code? Or do you think people will just use this for one zip code and thats it? And if thats the case, should I add an INI with the previously used zip code to the program, and then if they wish to change it they can do so via the context menu?

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

So I wen't ahead and added the ini which saves your previously used zip code.

I also added in error checking for the invalid URL's. You should no longer be closed out if your zip code is invalid. Let me know if you do.

https://sourceforge.net/projects/weatherwidget/

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Haha, alright then xD

Thanks!

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

So I finally figured out the whole refresh thing, as well as how to make it always sit in the background.

I've updated the script to version 1.5.

Added auto-refresh and also replaced the tray menu to Exit/Refresh.

I'm thinking I am done with this, finally ;)

https://sourceforge.net/projects/weatherwidget/

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

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