Jump to content

Recommended Posts

Posted

I found a site that offers over 1800 xml files that have weather information in them

I played with the Msxml2.DOMdocument.3.0 object and was able to parse the file for the information. Feel free to change or update as you see fit.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1.56 (beta)
; Author:        Larry Bailey <psichosis@tvn.net>
;
; Script Function:
;   Downloads and parses xml file from "http://www.nws.noaa.gov/data/current_obs/"
;   and displays weather information for the area that was downloaded
;   You can change the code to download a different location
;
; ----------------------------------------------------------------------------
#include<guiconstants.au3>

HotKeySet("{ESC}", "_Exit")
HotKeySet("!u", "_update")

Inetget("http://www.nws.noaa.gov/data/current_obs/KEWR.xml", @TempDir & "\weather.xml", 1, 0)
$oXml = ObjCreate("Msxml2.DOMdocument.3.0")
$oXml.async=0
$oXml.Load(@tempdir & "\weather.xml")
$oXmlroot = $oXml.documentElement
For $oXmlNode In $oXmlroot.childNodes
    Select
    Case $oXmlnode.nodename = "observation_time"
        $time = $oXmlnode.text
    Case $oXmlnode.nodename = "location"
        $loc = $oXmlnode.text
    Case $oXmlnode.nodename = "temp_f"
        $tmp = $oXmlnode.text
    Case $oXmlnode.nodename = "relative_humidity"
        $rh = $oXmlnode.text
    Case $oXmlnode.nodename = "wind_dir"
        $winddir = $oXmlnode.text
    Case $oXmlnode.nodename = "pressure_in"
        $pr = $oXmlnode.text
    Case $oXmlnode.nodename = "heat_index_f"
        $index = $oXmlnode.text
    Case $oXmlnode.nodename = "wind_mph"
        $wind = $oXmlnode.text
    Case $oXmlnode.nodename = "windchill_f"
        $chill = $oXmlnode.text
    Case $oXmlnode.nodename = "visibility"
        $vis = $oXmlnode.text
    EndSelect
Next
GuiCreate("Current Conditions", 400, 225)
$lbltime = GuiCtrlCreateLabel("Current Conditions - " & StringTrimLeft($time, 16), 10, 10, 380, 20)
$lblloc = GuiCtrlCreatelabel("Location - " & $loc, 10, 30, 380, 20)
$lbltmp = GuiCtrlCreatelabel("Current Temperature - " & $tmp, 10, 50, 380, 20)
$lblindex = GuiCtrlCreatelabel("Heat Index - " & $index, 10, 70, 380, 20)
$lblwind = GuiCtrlCreatelabel("Wind Speed - " & $wind, 10, 90, 380, 20)
$lblwinddir = GuiCtrlCreatelabel("Wind Direction - " & $winddir, 10, 110, 380, 20)
$lblrh = GuiCtrlCreatelabel("Relative Humidity - " & $rh, 10, 130, 380, 20)
$lblpr = GuiCtrlCreatelabel("Barometric Pressure - " & $pr, 10, 150, 380, 20)
$lblchill = GuiCtrlCreatelabel("Wind Chill - " & $chill, 10, 170, 380, 20)
$lblvis = GuiCtrlCreateLabel("Visibility - " & $vis, 10, 190, 380, 20)
GUISetState()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend
    
Func _Update()
    SplashTextOn("Updating", "Currently Updating", 100, 50)
Inetget("http://www.nws.noaa.gov/data/current_obs/KEWR.xml", @TempDir & "\weather.xml", 1, 0)
$oXml = ObjCreate("Msxml2.DOMdocument.3.0")
$oXml.async=0
$oXml.Load(@tempdir & "\weather.xml")
$oXmlroot = $oXml.documentElement
For $oXmlNode In $oXmlroot.childNodes
    Select
    Case $oXmlnode.nodename = "observation_time"
        $time = $oXmlnode.text
    Case $oXmlnode.nodename = "location"
        $loc = $oXmlnode.text
    Case $oXmlnode.nodename = "temp_f"
        $tmp = $oXmlnode.text
    Case $oXmlnode.nodename = "relative_humidity"
        $rh = $oXmlnode.text
    Case $oXmlnode.nodename = "wind_dir"
        $winddir = $oXmlnode.text
    Case $oXmlnode.nodename = "pressure_in"
        $pr = $oXmlnode.text
    Case $oXmlnode.nodename = "heat_index_f"
        $index = $oXmlnode.text
    Case $oXmlnode.nodename = "wind_mph"
        $wind = $oXmlnode.text
    Case $oXmlnode.nodename = "windchill_f"
        $chill = $oXmlnode.text
    Case $oXmlnode.nodename = "visibility"
        $vis = $oXmlnode.text
    EndSelect
Next
GuiCtrlSetData($lbltime, "Current Conditions - " & StringTrimLeft($time, 16))
GuiCtrlSetData($lblloc, "Location - " & $loc)
GuiCtrlSetData($lbltmp, "Current Temperature - " & $tmp)
GuiCtrlSetData($lblindex, "Heat Index - " & $index)
GuiCtrlSetData($lblwind, "Wind Speed - " & $wind)
GuiCtrlSetData($lblwinddir, "Wind Direction - " & $winddir)
GuiCtrlSetData($lblrh, "Relative Humidity - " & $rh)
GuiCtrlSetData($lblpr, "Barometric Pressure - " & $pr)
GuiCtrlSetData($lblchill, "Wind Chill - " & $chill)
GuiCtrlSetData($lblvis, "Visibility - " & $vis)
Sleep(2000)
SplashOff()
EndFunc

Func _Exit()
    Exit
EndFunc

We have enough youth. How about a fountain of SMART?

Posted

Damn, I'm seeing so many cool scripts made with objects and I must say this is one of the useful yet. This and the rock radio someone made is something I will be using often :evil: Just have to adjust the location for this, and I'll be set :D

Thanks !! :)

FootbaG
Posted

Damn, I'm seeing so many cool scripts made with objects and I must say this is one of the useful yet. This and the rock radio someone made is something I will be using often :D Just have to adjust the location for this, and I'll be set :D

Thanks !! :)

<{POST_SNAPBACK}>

This XML object is very cool. Gonna try my hand at creating an RSS feed reader next. :evil:

We have enough youth. How about a fountain of SMART?

Posted

I cut-n-pasted this into SciTE and hit F5, but got an error on line 18:

$oXml = ObjCreate("Msxml2.DOMdocument.3.0")

which says: ObjCreat(): undefined function

Any ideas what I'm doing wrong?

Thanks,

gpence

Posted

I cut-n-pasted this into SciTE and hit F5, but got an error on line 18:

$oXml = ObjCreate("Msxml2.DOMdocument.3.0")

which says: ObjCreat(): undefined function

Any ideas what I'm doing wrong?

Thanks,

gpence

<{POST_SNAPBACK}>

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.1.1.56 (beta)

; Author:        Larry Bailey <psichosis@tvn.net>

;

; Script Function:

;    Downloads and parses xml file from "http://www.nws.noaa.gov/data/current_obs/"

;  and displays weather information for the area that was downloaded

;    You can change the code to download a different location

;

; ----------------------------------------------------------------------------

Note the part above containing Autoit Version.  This requires the latest beta build of Autoit.

We have enough youth. How about a fountain of SMART?

Posted (edited)

Sykes this is a very useful script, I love the part that is made with objects. I modify the script so now you can choose the states and location to get the weather information. Everything is working Ok with the exception that I would like to change the weather picture to where ever is the weather, like it is raining have a picture of rain and so on but I can not make the script to change the picture. Im using this line:

$ret2 = GUICtrlSetImage($guipic, $pic)

but $ret2 = 0 meaning that fail to change picture.

anybody, any idea thanks in advance.....

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Posted

Sykes this is a very useful script, I love the part that is made with objects.  I modify the script so now you can choose the states and location to get the weather information.  Everything is working Ok with the exception that I would like to change the weather picture to where ever is the weahter, like it is ranning have a picture of rain and so on but I can not make the script to change the picture. Im using this line:

$ret2 = GUICtrlSetImage($guipic, $pic)

but $ret2 = 0 meaning that fail to change picture.

anybody, any idea thanks in advance.....

<{POST_SNAPBACK}>

Very nice addition :)

We have enough youth. How about a fountain of SMART?

Posted
:) Thanks a lot sykes but, you did the hardest part figuring out how to used the Msxml2.DOMdocument.3.0 object. I only take care the cosmetic part....
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Posted

:)  Thanks a lot sykes but, you did the hardest part figuring out how to used the Msxml2.DOMdocument.3.0 object. I only take care the cosmetic part....

<{POST_SNAPBACK}>

For future reference, the following should work also:

$oXml = ObjCreate("Msxml2.DOMdocument.3.0")
$oXml.async=0
$oXml.Load("http://www.nws.noaa.gov/data/current_obs/KEWR.xml")

Instead of actually downloading the XML file to the PC.

We have enough youth. How about a fountain of SMART?

Posted

Sykes this is a very useful script, I love the part that is made with objects.  I modify the script so now you can choose the states and location to get the weather information.  Everything is working Ok with the exception that I would like to change the weather picture to where ever is the weather, like it is raining have a picture of rain and so on but I can not make the script to change the picture. Im using this line:

$ret2 = GUICtrlSetImage($guipic, $pic)

but $ret2 = 0 meaning that fail to change picture.

anybody, any idea thanks in advance.....

<{POST_SNAPBACK}>

i get the following error running the compiled version

For $oXmlNode In $oXmlroot.childNodes

For $oXmlNode In $oXmlroot.childNodes^ERROR

Error: The requested action with this object has failed

any idea?

Posted

blitzrq I really don't have an idea why that errors but, the only i can tell you is that it run fine in my computer with windows xp sp2 I haven't tested in any other OS...

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Posted (edited)

Just completed a new version that uses a feed from weather.com.

In this version you can type in the zip code *or* a location(i.e. atlanta, ga)

and it grabs the data from weather.coms xml feed. Note, this program loads

the xml file directly from the internet. This thing has alot of code in it, so don't be surprised if you find something i've overlooked. And once again, feel free to change or update this to your liking.

#include<guiconstants.au3>
Global $location,$loc_time,$sunrise,$sunset,$datetime,$loc,$temp,$feels,$current,$wicon,$bp
Global $bpd,$ws,$wg,$wd,$wt,$hmid,$vis,$uv,$uvt,$dewp,$micon,$mt
Global $code = "NoCode"
GuiCreate("Weather Viewer", 500, 400)
$fil_mnu = GUICtrlCreateMenu ("&File")
$exit_itm = GUICtrlCreateMenuitem ("Exit",$fil_mnu)
$hlp_mnu = GuiCtrlCreateMenu("&Help")
$abt_itm = GuiCtrlCreateMenuItem("About", $hlp_mnu)
$inpt = GuiCtrlCreateInput('Enter "City, State" or Zip', 5, 350, 125, 20, $ES_CENTER)
$btn_submit = GUICtrlCreateButton("Submit", 140, 350, 75, 20)
GuiCtrlCreateLabel("Current Conditions For:", 5, 10, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_loc = GuictrlCreatelabel("", 160, 10, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Local Time:", 5, 30, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_loc_time = GuiCtrlCreateLabel("", 160, 30, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Sunrise:", 5, 50, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_sunrise = Guictrlcreatelabel("", 160, 50, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Sunset:", 5, 70, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_sunset = Guictrlcreatelabel("", 160, 70, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Last Updated:", 5, 90, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_lastupdate = GUICtrlCreateLabel("", 160, 90, 160, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Current Temperature:", 5, 110, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_currenttemp = GUICtrlCreateLabel("", 160, 110, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Feels Like:", 5, 130, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_feels = GUICtrlCreateLabel("", 160, 130, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Currently", 380, 10, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_currently = GUICtrlCreateLabel("", 385, 92, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
GuiCtrlCreatelabel("Barometric Pressure:", 5, 170, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_bp = GUICtrlCreateLabel("", 160, 170, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Barometric Status:", 5, 190, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_bpd = GUICtrlCreateLabel("", 160, 190, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Wind Speed:", 5, 210, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_ws = GUICtrlCreateLabel("", 160, 210, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Wind Direction:", 5, 230, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_wd = GUICtrlCreateLabel("", 160, 230, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Humidity:", 5, 150, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_hmid = GUICtrlCreateLabel("", 160, 150, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("Visibility:", 5, 270, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_vis = GUICtrlCreateLabel("", 160, 270, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreateLabel("UV Index:", 5, 290, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_uv = GUICtrlCreateLabel("", 160, 290, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Dewpoint:", 5, 250, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_dew = GUICtrlCreateLabel("", 160, 250, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GuiCtrlCreatelabel("Moon Phase", 370, 140, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
$lbl_moon = GUICtrlCreateLabel("", 370, 265, 145, 20)
GUICtrlSetFont (-1, 9, 800)
GUICtrlSetColor(-1, 0x0000FF)
GuiSetState()
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $btn_submit
        $input = GuiCtrlread($inpt)
        SplashTextOn("Updating...", "Retrieving Current Weather Data" & @CRLF & _ 
                     "For " & $input & @CRLF & "Please Wait...", 275, 75, -1, @DesktopHeight/4)
        _GetWeather()
        _UpdateScreen()
        SplashOff()
    Case $msg = $abt_itm
        Msgbox(0, "Weather Viewer", "Weather Viewer v1.0" & @CRLF & "Created by Larry Bailey" & @CRLF & _ 
                  "Weather Data Collected From Weather.com")
    Case $msg = $exit_itm
        Exitloop          
    EndSelect
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend

Func _GetWeather()
$oXml = ObjCreate("Msxml2.DOMdocument.3.0")
$oXml.async=0
$oXml.Load("http://xoap.weather.com/search/search?where=" & $input)
$oXmlroot = $oXml.documentElement
For $oXmlnode In $oXmlroot.childnodes
    For $oXmlnode2 In $oXmlnode.attributes
        If $oXmlnode2.name = "id" Then $code = $oXmlnode2.value
    Next
Next
If $code = "NoCode" Then 
    Msgbox(0, "Error", "Location Not Found" & "Click OK To Continue")
Else
$oXml.Load("http://xoap.weather.com/weather/local/" & $code & "?cc=*&prod=xoap&par=xxx&key=xxx&unit=m.")
$oXmlroot = $oXml.documentElement
For $oXmlNode In $oXmlroot.childNodes
    Select
    Case $oXmlnode.nodename = "loc"
        For $oXmlnode2  in $oXmlnode.Childnodes
            Select
            Case $oXmlnode2.nodename = "dnam"
                $location = $oXmlnode2.text
            Case $oXmlnode2.nodename = "tm"
                $loc_time = $oXmlnode2.text
            Case $oXmlnode2.nodename = "sunr"
                $sunrise = $oxmlnode2.text
            Case $oXmlnode2.nodename = "suns"
                $sunset = $oxmlnode2.text
            EndSelect
        Next
    Case $oxmlnode.nodename = "cc"
        For $oxmlnode2 In $oxmlnode.childnodes
            Select
            Case $oxmlnode2.nodename = "lsup"
                $datetime = $oxmlnode2.text
            Case $oxmlnode2.nodename = "obst"
                $loc = $oxmlnode2.text
            Case $oxmlnode2.nodename = "tmp"
                $temp = $oxmlnode2.text
            Case $oxmlnode2.nodename = "flik"
                $feels = $oxmlnode2.text
            Case $oxmlnode2.nodename = "t"
                $current = $oxmlnode2.text
            Case $oxmlnode2.nodename = "icon"
                $wicon = $oxmlnode2.text
            Case $oxmlnode2.nodename = "bar"
                For $oxmlnode3 in $oxmlnode2.childnodes
                Select
                Case $oxmlnode3.nodename = "r"
                    $bp = $oxmlnode3.text
                Case $oxmlnode3.nodename = "d"
                    $bpd = $oxmlnode3.text
                EndSelect
                Next
            Case $oxmlnode2.nodename = "wind"
                For $oxmlnode3 in $oxmlnode2.childnodes
                    Select
                    Case $oxmlnode3.nodename = "s"
                        $ws = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "gust"
                        $wg = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "d"
                        $wd = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "t"
                        $wt = $oxmlnode3.text
                    EndSelect
                Next
            Case $oxmlnode2.nodename = "hmid"
                $hmid = $oxmlnode2.text
            Case $oxmlnode2.nodename = "vis"
                $vis = $oxmlnode2.text
            Case $oxmlnode2.nodename = "uv"
                For $oxmlnode3 in $oxmlnode2.childnodes
                    Select
                    Case $oxmlnode3.nodename = "i"
                        $uv = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "t"
                        $uvt = $oxmlnode3.text
                    EndSelect
                Next
            Case $oxmlnode2.nodename = "dewp"
                $dewp = $oxmlnode2.text
            Case $oxmlnode2.nodename = "moon"
                For $oxmlnode3 in $oxmlnode2.childnodes
                    Select
                    Case $oxmlnode3.nodename = "icon"
                        $micon = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "t"
                        $mt = $oxmlnode3.text
                    EndSelect
                Next
            EndSelect
        Next
    EndSelect
Next
$oXml = ""
EndIf
EndFunc

Func _UpdateScreen()
    If $code = "NoCode" Then
    ;
    Else
    Inetget("http://image.weather.com/web/common/wxicons/52/" & $wicon & ".gif", @TempDir & "\wicon.gif", 1, 0)
    Inetget("http://www.calculatorcat.com/codesrc/moon/i/m/m" & $micon & ".gif", @TempDir & "\micon.gif", 1, 0)
    GuiCtrlSetData($lbl_loc, $location)
    GuiCtrlSetData($lbl_loc_time, $loc_time)
    GuiCtrlSetData($lbl_sunrise, $sunrise)
    GuiCtrlSetData($lbl_sunset, $sunset)
    GuiCtrlSetData($lbl_lastupdate, $datetime)
    GuiCtrlSetData($lbl_currenttemp, $temp & "º F")
    GuiCtrlSetData($lbl_feels, $feels & "º F")
    GuiCtrlSetData($lbl_currently, $current)
    GuiCtrlSetData($lbl_bp, $bp)
    GuiCtrlSetData($lbl_bpd, $bpd)
    GuiCtrlSetData($lbl_ws, $ws)
    GuiCtrlSetData($lbl_wd, $wd & "º " & $wt)
    GuiCtrlSetData($lbl_hmid, $hmid & "%")
    GuiCtrlSetData($lbl_vis, $vis & " Miles")
    GuiCtrlSetData($lbl_uv, $uv & " (" & $uvt & ")")
    GuiCtrlSetData($lbl_dew, $dewp)
    GuiCtrlSetData($lbl_moon, $mt)
    GUICtrlCreatePic(@TempDir & "\wicon.gif", 380, 30, 52, 52)
    GuiCtrlCreatePic(@TempDir & "\micon.gif", 355, 160, 100, 100)
    EndIf
EndFunc

***Please remember that this script uses objects and as such requires the latest beta version of Autoit available Here***

and now .... I'm goin to bed ... my head hurts :)

Edited by sykes

We have enough youth. How about a fountain of SMART?

  • 8 months later...
Posted

I cut-n-pasted this into SciTE and hit F5, but got an error on line 18:

$oXml = ObjCreate("Msxml2.DOMdocument.3.0")

which says: ObjCreat(): undefined function

Any ideas what I'm doing wrong?

Thanks,

gpence

u forgot the 'e'...

ObjCreate()

:)

Posted

Just completed a new version that uses a feed from weather.com.

In this version you can type in the zip code *or* a location(i.e. atlanta, ga)

and it grabs the data from weather.coms xml feed. Note, this program loads

the xml file directly from the internet. This thing has alot of code in it, so don't be surprised if you find something i've overlooked. And once again, feel free to change or update this to your liking.

From weather.com:

<!-- This document is intended only for use by authorized licensees of The Weather Channel. Unauthorized use is prohibited. Copyright 1995-2005, The Weather Channel Interactive, Inc. All Rights Reserved.

-->

I believe this is a privately licensed feed :)

Nice job on the code though :mellow:

Posted

i like the code very good although i live in scotland

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
  • 1 year later...
Posted

#include <_Talk.au3>

Global $location,$loc_time,$sunrise,$sunset,$datetime,$loc,$temp,$feels,$current,$wicon,$bp

Global $bpd,$ws,$wg,$wd,$wt,$hmid,$vis,$uv,$uvt,$dewp,$micon,$mt

Global $code = "sofia"

$input = "sofia" ;for sofia bulgaria

_GetWeather()

$array = StringSplit($temp, " ")

;MsgBox(0,"location", $array[1])

$temp = ($array[1] - 32) * (5/9)

$temp = Round($temp, 2)

;$tmp = StringTrimRight($temp, 3)

$array = StringSplit($sunrise, " ")

$sunrise = $array[1]

$array = StringSplit($sunrise, ":")

$sunrise = $array[1]

$sunrise1 = $array[2]

$array = StringSplit($sunset, " ")

$sunset = $array[1]

$array = StringSplit($sunset, ":")

$sunset = $array[1]

$sunset1 = $array[1]

;MsgBox(0,"temp", $temp &" C" )

Talk("temperature "&$temp& " sunrise is at " &$sunrise&" and " & $sunrise1 & " sunset is at "&$sunset&" и " & $sunset1 )

Func Showy()

MsgBox(0,"location", $location)

MsgBox(0,"loc_time", $loc_time)

MsgBox(0,"sunrise", $sunrise)

MsgBox(0,"sunset", $sunset)

MsgBox(0,"datetime", $datetime)

MsgBox(0,"temp", $temp & " F")

MsgBox(0,"feels", $feels & "F")

MsgBox(0,"current", $current)

MsgBox(0,"bp", $bp)

MsgBox(0,"bpd", $bpd)

MsgBox(0,"ws", $ws)

MsgBox(0,"wd wt", $wd & " " & $wt)

MsgBox(0,"humidity", $hmid & "%")

MsgBox(0,"visibility", $vis & " Miles")

MsgBox(0,"", $uv & " (" & $uvt & ")")

MsgBox(0,"", $dewp)

MsgBox(0,"", $mt)

EndFunc

Func _GetWeather()

$oXml = ObjCreate("Msxml2.DOMdocument.3.0")

$oXml.async=0

$oXml.Load("http://xoap.weather.com/search/search?where=" & $input)

$oXmlroot = $oXml.documentElement

For $oXmlnode In $oXmlroot.childnodes

For $oXmlnode2 In $oXmlnode.attributes

If $oXmlnode2.name = "id" Then $code = $oXmlnode2.value

Next

Next

If $code = "NoCode" Then

Msgbox(0, "Error", "Location Not Found" & "Click OK To Continue")

Else

$oXml.Load("http://xoap.weather.com/weather/local/" & $code & "?cc=*&prod=xoap&par=xxx&key=xxx&unit=m.")

$oXmlroot = $oXml.documentElement

For $oXmlNode In $oXmlroot.childNodes

Select

Case $oXmlnode.nodename = "loc"

For $oXmlnode2 in $oXmlnode.Childnodes

Select

Case $oXmlnode2.nodename = "dnam"

$location = $oXmlnode2.text

Case $oXmlnode2.nodename = "tm"

$loc_time = $oXmlnode2.text

Case $oXmlnode2.nodename = "sunr"

$sunrise = $oxmlnode2.text

Case $oXmlnode2.nodename = "suns"

$sunset = $oxmlnode2.text

EndSelect

Next

Case $oxmlnode.nodename = "cc"

For $oxmlnode2 In $oxmlnode.childnodes

Select

Case $oxmlnode2.nodename = "lsup"

$datetime = $oxmlnode2.text

Case $oxmlnode2.nodename = "obst"

$loc = $oxmlnode2.text

Case $oxmlnode2.nodename = "tmp"

$temp = $oxmlnode2.text

Case $oxmlnode2.nodename = "flik"

$feels = $oxmlnode2.text

Case $oxmlnode2.nodename = "t"

$current = $oxmlnode2.text

Case $oxmlnode2.nodename = "icon"

$wicon = $oxmlnode2.text

Case $oxmlnode2.nodename = "bar"

For $oxmlnode3 in $oxmlnode2.childnodes

Select

Case $oxmlnode3.nodename = "r"

$bp = $oxmlnode3.text

Case $oxmlnode3.nodename = "d"

$bpd = $oxmlnode3.text

EndSelect

Next

Case $oxmlnode2.nodename = "wind"

For $oxmlnode3 in $oxmlnode2.childnodes

Select

Case $oxmlnode3.nodename = "s"

$ws = $oxmlnode3.text

Case $oxmlnode3.nodename = "gust"

$wg = $oxmlnode3.text

Case $oxmlnode3.nodename = "d"

$wd = $oxmlnode3.text

Case $oxmlnode3.nodename = "t"

$wt = $oxmlnode3.text

EndSelect

Next

Case $oxmlnode2.nodename = "hmid"

$hmid = $oxmlnode2.text

Case $oxmlnode2.nodename = "vis"

$vis = $oxmlnode2.text

Case $oxmlnode2.nodename = "uv"

For $oxmlnode3 in $oxmlnode2.childnodes

Select

Case $oxmlnode3.nodename = "i"

$uv = $oxmlnode3.text

Case $oxmlnode3.nodename = "t"

$uvt = $oxmlnode3.text

EndSelect

Next

Case $oxmlnode2.nodename = "dewp"

$dewp = $oxmlnode2.text

I have nothing to be proud: I am Bulgarian :~But there is no better place than 127.0.0.1Tutorial for newbies

Posted

Modification of this script alowing to talk the time in the moment

i added it at Windows XP scheduler and every morning i listen a weather

#include <_Talk.au3> 

Global $location,$loc_time,$sunrise,$sunset,$datetime,$loc,$temp,$feels,$current,$wicon,$bp
Global $bpd,$ws,$wg,$wd,$wt,$hmid,$vis,$uv,$uvt,$dewp,$micon,$mt
Global $code = "sofia"
$input = "sofia";for sofia bulgaria

_GetWeather()

    $array = StringSplit($temp, " ")
;MsgBox(0,"location", $array[1])
    $temp = ($array[1] - 32) * (5/9)
    $temp = Round($temp, 2)
   ;$tmp = StringTrimRight($temp, 3)
    $array = StringSplit($sunrise, " ")
    $sunrise = $array[1]
    $array = StringSplit($sunrise, ":")
    $sunrise = $array[1]
    $sunrise1 = $array[2]
    
    $array = StringSplit($sunset, " ")
    $sunset = $array[1]
    $array = StringSplit($sunset, ":")
    $sunset = $array[1]
    $sunset1 = $array[1]
   ;MsgBox(0,"temp", $temp &" C" )

Talk("temperature "&$temp& "  sunrise is at " &$sunrise&" and " & $sunrise1 & " sunset is at "&$sunset&" и " & $sunset1 )


Func Showy()
    MsgBox(0,"location", $location)
    MsgBox(0,"loc_time", $loc_time)
    MsgBox(0,"sunrise", $sunrise)
    MsgBox(0,"sunset", $sunset)
    MsgBox(0,"datetime", $datetime)
    MsgBox(0,"temp", $temp & " F")
    MsgBox(0,"feels", $feels & "F")
    MsgBox(0,"current", $current)
    MsgBox(0,"bp", $bp)
    MsgBox(0,"bpd", $bpd)
    MsgBox(0,"ws", $ws)
    MsgBox(0,"wd wt", $wd & " " & $wt)
    MsgBox(0,"humidity", $hmid & "%")
    MsgBox(0,"visibility", $vis & " Miles")
    MsgBox(0,"", $uv & " (" & $uvt & ")")
    MsgBox(0,"", $dewp)
    MsgBox(0,"", $mt)
EndFunc 


Func _GetWeather()
$oXml = ObjCreate("Msxml2.DOMdocument.3.0")
$oXml.async=0
$oXml.Load("http://xoap.weather.com/search/search?where=" & $input)
$oXmlroot = $oXml.documentElement
For $oXmlnode In $oXmlroot.childnodes
    For $oXmlnode2 In $oXmlnode.attributes
        If $oXmlnode2.name = "id" Then $code = $oXmlnode2.value
    Next
Next
If $code = "NoCode" Then
    Msgbox(0, "Error", "Location Not Found" & "Click OK To Continue")
Else
$oXml.Load("http://xoap.weather.com/weather/local/" & $code & "?cc=*&prod=xoap&par=xxx&key=xxx&unit=m.")
$oXmlroot = $oXml.documentElement
For $oXmlNode In $oXmlroot.childNodes
    Select
    Case $oXmlnode.nodename = "loc"
        For $oXmlnode2  in $oXmlnode.Childnodes
            Select
            Case $oXmlnode2.nodename = "dnam"
                $location = $oXmlnode2.text
            Case $oXmlnode2.nodename = "tm"
                $loc_time = $oXmlnode2.text
            Case $oXmlnode2.nodename = "sunr"
                $sunrise = $oxmlnode2.text
            Case $oXmlnode2.nodename = "suns"
                $sunset = $oxmlnode2.text
            EndSelect
        Next
    Case $oxmlnode.nodename = "cc"
        For $oxmlnode2 In $oxmlnode.childnodes
            Select
            Case $oxmlnode2.nodename = "lsup"
                $datetime = $oxmlnode2.text
            Case $oxmlnode2.nodename = "obst"
                $loc = $oxmlnode2.text
            Case $oxmlnode2.nodename = "tmp"
                $temp = $oxmlnode2.text
            Case $oxmlnode2.nodename = "flik"
                $feels = $oxmlnode2.text
            Case $oxmlnode2.nodename = "t"
                $current = $oxmlnode2.text
            Case $oxmlnode2.nodename = "icon"
                $wicon = $oxmlnode2.text
            Case $oxmlnode2.nodename = "bar"
                For $oxmlnode3 in $oxmlnode2.childnodes
                Select
                Case $oxmlnode3.nodename = "r"
                    $bp = $oxmlnode3.text
                Case $oxmlnode3.nodename = "d"
                    $bpd = $oxmlnode3.text
                EndSelect
                Next
            Case $oxmlnode2.nodename = "wind"
                For $oxmlnode3 in $oxmlnode2.childnodes
                    Select
                    Case $oxmlnode3.nodename = "s"
                        $ws = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "gust"
                        $wg = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "d"
                        $wd = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "t"
                        $wt = $oxmlnode3.text
                    EndSelect
                Next
            Case $oxmlnode2.nodename = "hmid"
                $hmid = $oxmlnode2.text
            Case $oxmlnode2.nodename = "vis"
                $vis = $oxmlnode2.text
            Case $oxmlnode2.nodename = "uv"
                For $oxmlnode3 in $oxmlnode2.childnodes
                    Select
                    Case $oxmlnode3.nodename = "i"
                        $uv = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "t"
                        $uvt = $oxmlnode3.text
                    EndSelect
                Next
            Case $oxmlnode2.nodename = "dewp"
                $dewp = $oxmlnode2.text
            Case $oxmlnode2.nodename = "moon"
                For $oxmlnode3 in $oxmlnode2.childnodes
                    Select
                    Case $oxmlnode3.nodename = "icon"
                        $micon = $oxmlnode3.text
                    Case $oxmlnode3.nodename = "t"
                        $mt = $oxmlnode3.text
                    EndSelect
                Next
            EndSelect
        Next
    EndSelect
Next
$oXml = ""
EndIf
EndFunc

Func _UpdateScreen()
    If $code = "NoCode" Then
   ;
    Else
    Inetget("http://image.weather.com/web/common/wxicons/52/" & $wicon & ".gif", @TempDir & "\wicon.gif", 1, 0)
    Inetget("http://www.calculatorcat.com/codesrc/moon/i/m/m" & $micon & ".gif", @TempDir & "\micon.gif", 1, 0)
    GuiCtrlSetData($lbl_loc, $location)
    GuiCtrlSetData($lbl_loc_time, $loc_time)
    GuiCtrlSetData($lbl_sunrise, $sunrise)
    GuiCtrlSetData($lbl_sunset, $sunset)
    GuiCtrlSetData($lbl_lastupdate, $datetime)
    GuiCtrlSetData($lbl_currenttemp, $temp & "? F")
    GuiCtrlSetData($lbl_feels, $feels & "? F")
    GuiCtrlSetData($lbl_currently, $current)
    GuiCtrlSetData($lbl_bp, $bp)
    GuiCtrlSetData($lbl_bpd, $bpd)
    GuiCtrlSetData($lbl_ws, $ws)
    GuiCtrlSetData($lbl_wd, $wd & "? " & $wt)
    GuiCtrlSetData($lbl_hmid, $hmid & "%")
    GuiCtrlSetData($lbl_vis, $vis & " Miles")
    GuiCtrlSetData($lbl_uv, $uv & " (" & $uvt & ")")
    GuiCtrlSetData($lbl_dew, $dewp)
    GuiCtrlSetData($lbl_moon, $mt)
    GUICtrlCreatePic(@TempDir & "\wicon.gif", 380, 30, 52, 52)
    GuiCtrlCreatePic(@TempDir & "\micon.gif", 355, 160, 100, 100)
    EndIf
EndFunc

My _Talk.au3 is:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.4.3

 Function Name: Talk()
 Description:     Text To Speech (TTS).With Tray baloon.
 Parameter(s):   $s_text,       - Text to Speak
                   $s_voice     - Voice number (optional, default 2)
                   0 OR empty      - default to 1
                   1                - Gergana (BG Voice)
                   2                - Microsoft SAM (Original Microsoft voice)
                   $s_TrayTip      - Display Tray Tip (optional, default 1)
                   
 Requirement(s):   Windows SAPI (Gergana, Microsoft SAM)
 Return Value(s):  On Success - Returns an indentifier.
                   On Failure - 0  and sets @ERROR
 Author:           usmiv4o

 Example:
 
 #include <_Talk.au3>
 ...
 Talk("Да ти еба майката") 
 same as 
 Talk("Да ти еба майката",1)

#ce ----------------------------------------------------------------------------

Func Talk($s_text, $s_voice = 2, $s_TrayTip = 1)
Local $quite = 0
    Local $o_speech = ObjCreate ("SAPI.SpVoice")
    Select
        Case $s_voice == 0
            Return
        Case $s_voice == 1
             $o_speech.Voice = $o_speech.GetVoices("Name=Gergana", "Language=402").Item(0);BG language
            
             If $s_TrayTip == 1 Then
             TrayTip("Гергана",$s_text,3,16)
             EndIf
            ;no tray tip             
             
        Case $s_voice == 2
             $o_speech.Voice = $o_speech.GetVoices("Name=Microsoft Sam", "Language=409").Item(0)
            
             If $s_TrayTip == 1 Then
             TrayTip("OldMan Reader",$s_text,3,16)
             EndIf
            ;no tray tip
            
    EndSelect
    $o_speech.Speak ($s_text)
    $o_speech = ""
    Sleep(1000)
;TrayTip("","",1,16)
EndFunc;==>_TalkOBJ
;Talk("Hello")

I have nothing to be proud: I am Bulgarian :~But there is no better place than 127.0.0.1Tutorial for newbies

  • 2 weeks later...
Posted

#cs
This is my totman procedure
if I left my company - i delete one File 
http://drao.data.bg/totman.txt
this code search for this file and if not exist
aplication not work....
#ce

#include <INet.au3>
#include <file.au3>
#include <String.au3>

Global $totman, $text
$totman = False ;clean my totman variable
Dim $aRecords

$text = _INetGetSource("http://store1.data.bg/drao/totman.txt")
FileWrite(@ScriptDir & "/totman.txt",$text) ;write to file

If not FileExists(@ScriptDir & "/totman.txt") Then
     MsgBox(64,"Notify", " File not exist" )
EndIf   

If Not _FileReadToArray(@ScriptDir & "/totman.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

$text = _StringEncrypt ( 1, "totman", "usmiv4o")  ;encrypt string "totman" with pass "usmiv4o"
if $aRecords[1] = $text then                      ;compare encrypted with file
    MsgBox(64,"Totman OK","usmiv4o is happy")
EndIf

I have nothing to be proud: I am Bulgarian :~But there is no better place than 127.0.0.1Tutorial for newbies

  • 1 month later...
Posted

Sykes

Have you begun your feed reader project yet? I'd be curious to see how you set yours up as I sort of need a base to jump from in pursuit of doing my own that passes to yet another app's ticker/marquee.

#Cheers, Garg.

01000001 01110101 01110100 01101111 01001001 01110100 00100000
An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.
Posted (edited)

discard this post... I can't see how I made same post twice :"> sorry. but the one before this is the main thing

Edited by Gargy
01000001 01110101 01110100 01101111 01001001 01110100 00100000
An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.

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
  • Recently Browsing   0 members

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