Sign in to follow this  
Followers 0
Simucal

Forecast (scrap)

6 posts in this topic

#1 ·  Posted (edited)

Originally I had written these to add them to the "WeatherCenter" script that is floating around but I'm not interested in the project anymore. I'm cleaning out my scripts directory and thought I would upload this.

They rip the 10 day forecast off weather.com and Today's forecast for a specified zip code.

If anyone wants to use these feel free:

Posted Image

Posted Image

; Written by: Simucal
#include <guiconstants.au3>
#include <array.au3>
_get10day()
_GetToday()

Func _GetToday()

    $zip = InputBox("Zip Code","Enter your zip code:")
    FileDelete(@TempDir & "\today.dat")
    InetGet("http://www.weather.com/outlook/homeandgarden/garden/local/" & $zip, @TempDir & "\today.dat", 1, 0)
    $TodayFile = FileRead(@TempDir & "\today.dat", FileGetSize(@TempDir & "\today.dat"))
    $PicArray = StringRegExp($TodayFile, '(?:<IMG SRC=)(http://image.weather.com/web/common/wxicons/[0-9]{1,3}/[0-9]{1,3}.gif)(?: WIDTH=52 HEIGHT=52)', 3)
    InetGet($PicArray[0], @TempDir & "\main.gif")
    $InfoArray = StringRegExp($TodayFile, '(?:ALT=""></td>[:space:]*?<TD VALIGN="top"  CLASS="obsTextA">)(.*?)(?:[:space:]*)?(?:<)', 3)
    $SmallArray = StringRegExp($TodayFile, '(?:WIDTH=52 HEIGHT=52 BORDER=0 ALT=><BR><B CLASS=obsTextA>)(.*?)(?:</B>)', 3)
    $TempArray = StringRegExp($TodayFile, '(?:<B CLASS=obsTempTextA>)([:digit:]+)(?:.+;F</B><BR><B CLASS=obsTextA>Feels Like<BR>\s+)([:digit:]+)(?:.+?;F</B></DIV></TD>)', 3)
    $TodayForm = GUICreate("Today's Forcast", 321, 345)
    
    $largepic = GUICtrlCreatePic(@TempDir & "\main.gif", 16, 32, 52, 52)
    GUICtrlCreateLabel($SmallArray[0], 8, 88, 73, 17, $SS_CENTER)
    $uvindex = GUICtrlCreateLabel("UV Index:" & @TAB & $InfoArray[0], 168, 32, 200, 17)
    $wind = GUICtrlCreateLabel("Wind:" & @TAB & @TAB & $InfoArray[1], 168, 48, 200, 17)
    $humidity = GUICtrlCreateLabel("Humidity:" & @TAB & $InfoArray[2], 168, 64, 200, 17)
    $pressure = GUICtrlCreateLabel("Pressure:" & @TAB & StringTrimRight($InfoArray[3], 8), 168, 80, 200, 17)
    $dewpoint = GUICtrlCreateLabel("Dew Point:" & @TAB & StringTrimRight($InfoArray[4], 5) & "°F", 168, 96, 200, 17)
    $visibility = GUICtrlCreateLabel("Visibility:" & @TAB & @TAB & $InfoArray[5], 168, 112, 200, 17)
    $largetemp = GUICtrlCreateLabel($TempArray[0] & "°F", 80, 32, 76, 41, $SS_CENTER)
    GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
    $feelslike = GUICtrlCreateLabel("Feels Like" & @CRLF & $TempArray[1]& "°F", 88, 72, 52, 35, $SS_CENTER)
    $ZipLbl = GUICtrlCreateLabel("Zip Code: " & $zip, 16, 8, 120, 17)
    GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
    $bigdesc = GUICtrlCreateInput("Todays Weather:", 16, 150, 285, 175, -1, $WS_EX_CLIENTEDGE)
    GUICtrlCreateLabel("Forecast Info:", 16, 132, 69, 17)
    GUISetState(@SW_SHOW)
    While 1
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
    GUIDelete($TodayForm)
EndFunc;==>_GetToday
Func _Get10Day()
    $zip = InputBox("Zip Code","Enter your zip code:")
    FileDelete(@TempDir & "\10day.dat")
    
    InetGet("http://www.weather.com/outlook/driving/interstate/tenday/" & $zip, @TempDir & "\10day.dat", 1, 0)
    $10DayFile = FileRead(@TempDir & "\10day.dat", FileGetSize(@TempDir & "\10day.dat"))
    $PicArray = StringRegExp($10DayFile, '(?:tendayIconDay[0-9]{1,2}" SRC=")(http://image.weather.com/web/common/wxicons/[0-9]{1,2}/[0-9]{1,2}.gif)(?:")', 3)
    For $i = 0 to (UBound($PicArray) - 1)
        InetGet($PicArray[$i], @TempDir & "\pic" & $i & ".gif")
    Next
    
    $DayArray = StringRegExp($10DayFile, '(?:"/outlook/driving/interstate/wxdetail/[0-9]{5}\?dayNum=[0-9]"><B>)([a-zA-Z]*)(?:</B>)', 3)
    $DescArray = StringRegExp(StringRegExpReplace($10DayFile, '(?:"padding:0px 3px 0px 0px;">)([a-zA-Z]*?)(?:\s*?)([a-zA-Z]*?)(?:</TD>)', '~~\1' & @CRLF & '\2~~', 0), '~~(.*?)~~|"padding:0px 3px 0px 0px;">(.*?)</TD>', 3)
    $TempArray = StringRegExp($10DayFile, '(?:CLASS="blueVerdanaText11">)([a-zA-Z0-9/]{1,4})(?:.+?;)?(?:</B>/)([a-zA-Z0-9/]{1,3})(?:.+?;</TD>)', 3)
;"blueVerdanaText11">75&deg;</B>/57&deg;</TD>
    $PrecipArray = StringRegExp($10DayFile, '(?:<TD WIDTH="50" CLASS="blueVerdanaText10" ALIGN="CENTER">[:space:]*)([0-9]{1,3}%)(?:[:space:]*</td>)', 3)
    If UBound($PicArray) = 10 Then
        $10DayForm = GUICreate("10 Day Forecast", 890, 183)
    Else
        $10DayForm = GUICreate("10 Day Forecast", 790, 183)
    EndIf
    GUICtrlSetColor($10DayForm, 0xE0DFE3)
    $ZipLbl = GUICtrlCreateLabel("Zip Code: " & $zip, 56, 8, 120, 17)
    GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif")
    $Day1 = GUICtrlCreateGroup($DayArray[0], 56, 32, 73, 89)
    $Day2 = GUICtrlCreateGroup($DayArray[1], 136, 32, 73, 89)
    $Day3 = GUICtrlCreateGroup($DayArray[2], 216, 32, 73, 89)
    $Day4 = GUICtrlCreateGroup($DayArray[3], 296, 32, 73, 89)
    $Day5 = GUICtrlCreateGroup($DayArray[4], 376, 32, 73, 89)
    $Day6 = GUICtrlCreateGroup($DayArray[5], 456, 32, 73, 89)
    $Day7 = GUICtrlCreateGroup($DayArray[6], 536, 32, 73, 89)
    $Day8 = GUICtrlCreateGroup($DayArray[7], 617, 32, 73, 89)
    $Day9 = GUICtrlCreateGroup($DayArray[8], 696, 32, 73, 89)
    If UBound($PicArray) = 10 Then $Day10 = GUICtrlCreateGroup($DayArray[9], 775, 31, 73, 89)
    $Pic1 = GUICtrlCreatePic(@TempDir & "\pic0.gif", 76, 51, 31, 31)
    $Pic2 = GUICtrlCreatePic(@TempDir & "\pic1.gif", 156, 51, 31, 31)
    $Pic3 = GUICtrlCreatePic(@TempDir & "\pic2.gif", 236, 51, 31, 31)
    $Pic4 = GUICtrlCreatePic(@TempDir & "\pic3.gif", 316, 51, 31, 31)
    $Pic5 = GUICtrlCreatePic(@TempDir & "\pic4.gif", 396, 51, 31, 31)
    $Pic6 = GUICtrlCreatePic(@TempDir & "\pic5.gif", 476, 51, 31, 31)
    $Pic7 = GUICtrlCreatePic(@TempDir & "\pic6.gif", 556, 51, 31, 31)
    $Pic8 = GUICtrlCreatePic(@TempDir & "\pic7.gif", 637, 51, 31, 31)
    $Pic9 = GUICtrlCreatePic(@TempDir & "\pic8.gif", 716, 51, 31, 31)
    If UBound($PicArray) = 10 Then $Pic10 = GUICtrlCreatePic(@TempDir & "\pic9.gif", 795, 50, 31, 31)
    $Desc1 = GUICtrlCreateLabel($DescArray[0], 58, 85, 70, 30, $SS_CENTER)
    $Desc2 = GUICtrlCreateLabel($DescArray[1], 138, 85, 70, 30, $SS_CENTER)
    $Desc3 = GUICtrlCreateLabel($DescArray[2], 218, 85, 70, 30, $SS_CENTER)
    $Desc4 = GUICtrlCreateLabel($DescArray[3], 298, 85, 70, 30, $SS_CENTER)
    $Desc5 = GUICtrlCreateLabel($DescArray[4], 378, 85, 70, 30, $SS_CENTER)
    $Desc6 = GUICtrlCreateLabel($DescArray[5], 458, 85, 70, 30, $SS_CENTER)
    $Desc7 = GUICtrlCreateLabel($DescArray[6], 538, 85, 70, 30, $SS_CENTER)
    $Desc8 = GUICtrlCreateLabel($DescArray[7], 619, 85, 70, 30, $SS_CENTER)
    $Desc9 = GUICtrlCreateLabel($DescArray[8], 698, 85, 70, 30, $SS_CENTER)
    If UBound($PicArray) = 10 Then $Desc10 = GUICtrlCreateLabel($DescArray[9], 777, 84, 70, 30, $SS_CENTER)
    $Temp1 = GUICtrlCreateLabel($TempArray[0] & "°/" & $TempArray[1] & "°", 56, 128, 73, 17, $SS_CENTER)
    $Temp2 = GUICtrlCreateLabel($TempArray[2] & "°/" & $TempArray[3] & "°", 136, 128, 73, 17, $SS_CENTER)
    $Temp3 = GUICtrlCreateLabel($TempArray[4] & "°/" & $TempArray[5] & "°", 216, 128, 73, 17, $SS_CENTER)
    $Temp4 = GUICtrlCreateLabel($TempArray[6] & "°/" & $TempArray[7] & "°", 296, 128, 73, 17, $SS_CENTER)
    $Temp5 = GUICtrlCreateLabel($TempArray[8] & "°/" & $TempArray[9] & "°", 376, 128, 73, 17, $SS_CENTER)
    $Temp6 = GUICtrlCreateLabel($TempArray[10] & "°/" & $TempArray[11] & "°", 456, 128, 73, 17, $SS_CENTER)
    $Temp7 = GUICtrlCreateLabel($TempArray[12] & "°/" & $TempArray[13] & "°", 536, 128, 73, 17, $SS_CENTER)
    $Temp8 = GUICtrlCreateLabel($TempArray[14] & "°/" & $TempArray[15] & "°", 616, 128, 73, 17, $SS_CENTER)
    $Temp9 = GUICtrlCreateLabel($TempArray[16] & "°/" & $TempArray[17] & "°", 696, 128, 73, 17, $SS_CENTER)
    If UBound($PicArray) = 10 Then $Temp10 = GUICtrlCreateLabel($TempArray[18] & "°/" & $TempArray[19] & "°", 776, 128, 73, 17, $SS_CENTER)
    $Precip1 = GUICtrlCreateLabel($PrecipArray[0], 56, 152, 73, 17, $SS_CENTER)
    $Precip2 = GUICtrlCreateLabel($PrecipArray[1], 136, 152, 73, 17, $SS_CENTER)
    $Precip3 = GUICtrlCreateLabel($PrecipArray[2], 216, 152, 73, 17, $SS_CENTER)
    $Precip4 = GUICtrlCreateLabel($PrecipArray[3], 296, 152, 73, 17, $SS_CENTER)
    $Precip5 = GUICtrlCreateLabel($PrecipArray[4], 376, 152, 73, 17, $SS_CENTER)
    $Precip6 = GUICtrlCreateLabel($PrecipArray[5], 456, 152, 73, 17, $SS_CENTER)
    $Precip7 = GUICtrlCreateLabel($PrecipArray[6], 536, 152, 73, 17, $SS_CENTER)
    $Precip8 = GUICtrlCreateLabel($PrecipArray[7], 616, 152, 73, 17, $SS_CENTER)
    $Precip9 = GUICtrlCreateLabel($PrecipArray[8], 696, 152, 73, 17, $SS_CENTER)
    If UBound($PicArray) = 10 Then $Precip10 = GUICtrlCreateLabel($PrecipArray[9], 776, 152, 73, 17, $SS_CENTER)
    GUICtrlCreateLabel("High/Low:", 8, 128, 55, 15)
    GUICtrlCreateLabel("Precip:", 8, 152, 55, 17)
    GUISetState(@SW_SHOW)
    While 1
        $msg2 = GUIGetMsg()
        Select
            Case $msg2 = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
    GUIDelete($10DayForm)
EndFunc;==>_Get10Day
Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites



I get Array errors


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
Share on other sites

Should be fixed. The forum was turning "&deg" into the actual degree symbol for some reason. I made my regexp not use "&deg" and used something more general.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

Should be fixed. The forum was turning "&deg" into the actual degree symbol for some reason. I made my regexp not use "&deg" and used something more general.

I also got an array error

>"C:\Program Files\AutoIt3\SciTE\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "Z:\snippets\10 weather forcast\10day.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams

>Running AU3Check C:\Program Files\AutoIt3\SciTE\Defs\Unstable\Au3Check\au3check.dat

>AU3Check Ended. No Error(s).

>Running: (3.1.1.111):C:\Program Files\AutoIt3\beta\autoit3.exe "Z:\snippets\10 weather forcast\10day.au3"

Z:\snippets\10 weather forcast\10day.au3 (73) : ==> Subscript used with non-Array variable.:

$Day1 = GUICtrlCreateGroup($DayArray[0], 56, 32, 73, 89)

$Day1 = GUICtrlCreateGroup($DayArray^ ERROR

>AutoIT3.exe ended.

>Exit code: 0 Time: 3.722


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

The array problem has been fixed. Earlier the forum was converting the &deg to an actual degree symbol which messed it up.

It should only say:

Z:\snippets\10 weather forcast\10day.au3 (73) : ==> Subscript used with non-Array variable.:
$Day1 = GUICtrlCreateGroup($DayArray[0], 56, 32, 73, 89)
$Day1 = GUICtrlCreateGroup($DayArray^ ERROR

If you put in an incorrect area code. Try 65201 for an example.

Can anyone else try this and tell me if it works for them? The zip must be a 5 digit numerical zip code. I also tried 90210.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

Thanks, This is cool!

Great job


[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0