Jump to content

Search the Community

Showing results for tags 'weather'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. Hi, this is a small little tool i made to show me some information about the weather in my area. I downloaded the icons and converted to png's, so it shows the icon for today and tomorrow, if it's sunny or cloudy etc and bellow the image it shows only 2 numbers max and min temps forecast for the day. Can be made to start with windows in the tray menu. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=ipma.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By:careca #AutoIt3Wrapper_Res_Description=IPMA Get Weather for Sines #AutoIt3Wrapper_Res_Fileversion=1.1 #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Icon_Add=ipma.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;============================================================================= #Region ;Include + Opt #include <IE.au3> #include <File.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <WinAPIGdi.au3> #include <GuiTreeView.au3> #include <TrayConstants.au3> #include <ScreenCapture.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 1) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) #EndRegion ;Include + Opt ;============================================================================= #Region ;GuiVars + FileInstall Global $GUI, $Button_1, $hGraphic, $hGraphic2, $sString, $hFont, $aInfo, $hFormat, $hBrush, $hImage, $hImageR, $hFamily, $tLayout, $IndexDay, $RefreshItem, $wpos Global $ExitItem, $Label, $Label1, $oIE, $oDoc, $oElement1, $oElement2, $StringMid, $Split1, $Split2, $Trim, $Number, $ID, $Pic, $String, $SetString, $CfgFldr Global $Day = 0, $WS, $StartWinCheck Global Const $AC_SRC_ALPHA = 1 Global $i_x1 = 0, $i_y1 = 0, $i_x3 = 25, $i_y3 = 25 Global $aMousePos, $aMousePos2, $iMouseOver = 0 Global $InstallDir = @LocalAppDataDir & '\ipma' DirCreate($InstallDir & '\SVG') Global $cfg = $InstallDir & '\ipma.ini' Global $aProcessList = ProcessList(@AutoItExe) If $aProcessList[0][0] >= 2 Then Exit If StringInStr($cmdlineRaw, "/source") Then FileInstall(@ScriptFullPath, $InstallDir & '\' & @ScriptName, 1) Exit EndIf FileInstall("ipma.ico", $InstallDir & '\ipma.ico', 1) FileInstall('.\SVG\w_ic_d_01anim.png', $InstallDir & '\SVG\w_ic_d_01anim.png', 1) FileInstall('.\SVG\w_ic_d_02anim.png', $InstallDir & '\SVG\w_ic_d_02anim.png', 1) FileInstall('.\SVG\w_ic_d_03anim.png', $InstallDir & '\SVG\w_ic_d_03anim.png', 1) FileInstall('.\SVG\w_ic_d_04anim.png', $InstallDir & '\SVG\w_ic_d_04anim.png', 1) FileInstall('.\SVG\w_ic_d_05anim.png', $InstallDir & '\SVG\w_ic_d_05anim.png', 1) FileInstall('.\SVG\w_ic_d_06anim.png', $InstallDir & '\SVG\w_ic_d_06anim.png', 1) FileInstall('.\SVG\w_ic_d_07anim.png', $InstallDir & '\SVG\w_ic_d_07anim.png', 1) FileInstall('.\SVG\w_ic_d_08anim.png', $InstallDir & '\SVG\w_ic_d_08anim.png', 1) FileInstall('.\SVG\w_ic_d_09anim.png', $InstallDir & '\SVG\w_ic_d_09anim.png', 1) FileInstall('.\SVG\w_ic_d_10anim.png', $InstallDir & '\SVG\w_ic_d_10anim.png', 1) FileInstall('.\SVG\w_ic_d_11anim.png', $InstallDir & '\SVG\w_ic_d_11anim.png', 1) FileInstall('.\SVG\w_ic_d_12anim.png', $InstallDir & '\SVG\w_ic_d_12anim.png', 1) FileInstall('.\SVG\w_ic_d_13anim.png', $InstallDir & '\SVG\w_ic_d_13anim.png', 1) FileInstall('.\SVG\w_ic_d_14anim.png', $InstallDir & '\SVG\w_ic_d_14anim.png', 1) FileInstall('.\SVG\w_ic_d_15anim.png', $InstallDir & '\SVG\w_ic_d_15anim.png', 1) FileInstall('.\SVG\w_ic_d_16anim.png', $InstallDir & '\SVG\w_ic_d_16anim.png', 1) FileInstall('.\SVG\w_ic_d_17anim.png', $InstallDir & '\SVG\w_ic_d_17anim.png', 1) FileInstall('.\SVG\w_ic_d_18anim.png', $InstallDir & '\SVG\w_ic_d_18anim.png', 1) FileInstall('.\SVG\w_ic_d_20anim.png', $InstallDir & '\SVG\w_ic_d_20anim.png', 1) FileInstall('.\SVG\w_ic_d_23anim.png', $InstallDir & '\SVG\w_ic_d_23anim.png', 1) FileInstall('.\SVG\w_ic_d_25anim.png', $InstallDir & '\SVG\w_ic_d_25anim.png', 1) FileInstall('.\SVG\w_ic_d_26anim.png', $InstallDir & '\SVG\w_ic_d_26anim.png', 1) FileInstall('.\SVG\w_ic_d_27anim.png', $InstallDir & '\SVG\w_ic_d_27anim.png', 1) FileInstall('.\SVG\w_ic_d_28anim.png', $InstallDir & '\SVG\w_ic_d_28anim.png', 1) FileInstall('.\SVG\w_ic_d_29anim.png', $InstallDir & '\SVG\w_ic_d_29anim.png', 1) FileInstall('.\SVG\w_ic_d_30anim.png', $InstallDir & '\SVG\w_ic_d_30anim.png', 1) #EndRegion ;GuiVars + FileInstall ;============================================================================= #Region ;GUI TraySetIcon("ipma.ico") $GUI = GUICreate('IPMA', 1, 1, @DesktopWidth - 220, @DesktopHeight - 180, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOOLWINDOW) GUISetBkColor(0x444444) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $WS = TrayCreateItem("StartWithWindows") GUICtrlSetTip(-1, 'Startup with windows', "Startup", 1) TrayItemSetOnEvent($WS, "StartWinChoose") $CfgFldr = TrayCreateItem("Config Folder") TrayItemSetOnEvent(-1, "CfgFolder") $RefreshItem = TrayCreateItem("Refresh") TrayItemSetOnEvent(-1, "Start") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") TraySetState(1) TraySetClick(8) TraySetOnEvent($TRAY_EVENT_MOUSEOVER, "_overTray") _Load() GUISetState() ;WinSetOnTop($GUI, '', 1) _GDIPlus_Startup() _WinAPI_SetLayeredWindowAttributes($GUI, 0xABCDEF, 240) ;0xABCDEF 0xFFFFFF 0x000000 Global $WX = 150, $WY = 110 ;WinMove($GUI, '', @DesktopWidth - 180, @DesktopHeight - 150, $WX, $WY, 1) WinMove($GUI, '', @DesktopWidth + 1000, @DesktopHeight + 1000, $WX, $WY, 1) _GuiRoundCorners($GUI, $i_x1, $i_y1, $i_x3, $i_y3) ;============================================================================= ;_SetGraphics('today', 0, 10) ;_SetGraphics('tomorrow', 70, 10) ;============================================================================= ;_SetLabel(IniRead($cfg, 'String', 'today', ''), 10, 80) ;_SetLabel(IniRead($cfg, 'String', 'tomorrow', ''), 85, 80) #EndRegion ;GUI ;============================================================================= Start() ;============================================================================= Func _SetGraphics($Day, $x, $y) $hImage = _GDIPlus_ImageLoadFromFile($InstallDir & '\SVG\w_ic_d_' & IniRead($cfg, 'ImageID', $Day, '') & 'anim.png') $hImageR = _GDIPlus_ImageResize($hImage, 100, 100, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($GUI) _GDIPlus_GraphicsDrawImageRect($hGraphic2, $hImageR, $x, $y, 75, 75) _GDIPlus_ImageDispose($hImage) _GDIPlus_BitmapDispose($hImageR) _GDIPlus_GraphicsDispose($hGraphic2) EndFunc ;==>_SetGraphics ;============================================================================= Func _SetLabel($String, $x, $y) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($GUI) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 12, 1) $tLayout = _GDIPlus_RectFCreate($x, $y, 390, 50) $hBrush = _GDIPlus_BrushCreateSolid("0xFFFFFFFF") _GDIPlus_GraphicsDrawStringEx($hGraphic, $String, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontDispose($hFont) _GDIPlus_BrushDispose($hBrush) EndFunc ;==>_SetLabel ;============================================================================= Func Start() TrayItemSetState($RefreshItem, $TRAY_UNCHECKED) If WinExists("Instituto") = 0 Then $oIE = _IECreate("http://www.ipma.pt/pt/index.html", 0, 0, 1, 1) _IELoadWait($oIE) ;Else ;WinActivate("Instituto") ;$oIE = _IEAttach("Instituto", 'title', 1) EndIf If Not @error Then _Temps() _Icon() _Tomorrow() _Temps() _Icon() _Today() _IEQuit($oIE) ;============================================================================= Else ;MsgBox(64 + 262144, '', 'Fail') EndIf EndFunc ;==>Start ;============================================================================= Func _overTray() $aMousePos = MouseGetPos() If Not $iMouseOver Then AdlibRegister("_checkMouseOverTrayAdlib", 100) $iMouseOver = 1 EndFunc ;==>_overTray ;============================================================================= Func _checkMouseOverTrayAdlib() $wpos = WinGetPos($GUI) $aMousePos2 = MouseGetPos() If $aMousePos2[0] <> $aMousePos[0] Or $aMousePos2[1] <> $aMousePos[1] Then $iMouseOver = 0 AdlibUnRegister("_checkMouseOverTrayAdlib") If $wpos[0] <> @DesktopWidth + 1000 Or $wpos[1] <> @DesktopHeight + 1000 Then WinMove($GUI, '', @DesktopWidth + 1000, @DesktopHeight + 1000, Null, Null, 1) EndIf Return EndIf ;============================================================================= If $wpos[0] <> @DesktopWidth - 180 Or $wpos[1] <> @DesktopHeight - 150 Then WinMove($GUI, '', @DesktopWidth - 180, @DesktopHeight - 150, $WX, $WY, 1) ;============================================================================= _SetGraphics('today', 0, 10) _SetGraphics('tomorrow', 70, 10) ;============================================================================= _SetLabel(IniRead($cfg, 'String', 'today', ''), 10, 80) _SetLabel(IniRead($cfg, 'String', 'tomorrow', ''), 85, 80) ;============================================================================= EndIf EndFunc ;==>_checkMouseOverTrayAdlib ;============================================================================= Func _Today() Local $oIE_ObjectToClick1 = _IEGetObjById($oIE, 'today') _IEAction($oIE_ObjectToClick1, 'click') _IELoadWait($oIE) ConsoleWrite(@CRLF) $Day = 0 EndFunc ;==>_Today ;============================================================================= Func _Tomorrow() Local $oIE_ObjectToClick1 = _IEGetObjById($oIE, 'tomorrow') _IEAction($oIE_ObjectToClick1, 'click') _IELoadWait($oIE) ConsoleWrite(@CRLF) $Day = 1 EndFunc ;==>_Tomorrow ;============================================================================= Func _Temps() ;Temp Max/Min $oDoc = _IEDocReadHTML($oIE) $oElement1 = StringInStr($oDoc, "color: rgb(255, 255, 255); font-weight: normal; margin-top: -20px; margin-left: 14px; z-index: 312; opacity: 0.9; transform: translate(115px, 312px); background-color: transparent;") If Not @error Then $oElement2 = StringInStr($oDoc, "color: rgb(255, 255, 255); font-weight: normal; margin-top: -20px; margin-left: 14px; z-index: 41; opacity: 0.9; transform: translate(116px, 41px); background-color: transparent;") If Not @error Then $StringMid = StringMid($oDoc, $oElement1, $oElement2 - $oElement1) $Split1 = StringSplit($StringMid, "tMax", 1) $Split2 = StringSplit($StringMid, "tMin", 1) $SetString = StringLeft(StringTrimLeft($Split1[2], 2), StringInStr($Split1[2], '<') - 3) & ' - ' & StringLeft(StringTrimLeft($Split2[2], 2), StringInStr($Split2[2], '<') - 3) If $Day = 0 Then IniWrite($cfg, 'String', 'today', $SetString) Else IniWrite($cfg, 'String', 'tomorrow', $SetString) EndIf EndIf EndIf EndFunc ;==>_Temps ;============================================================================= Func _Icon() ;Icon $oDoc = _IEDocReadHTML($oIE) $oElement1 = StringInStr($oDoc, "color: transparent; font-weight: normal; margin-top: -15px; margin-left: -15px; z-index: 312; opacity: 0.9; transform: translate(115px, 312px); background-color: transparent;") If Not @error Then $oElement2 = StringInStr($oDoc, "color: transparent; font-weight: normal; margin-top: -15px; margin-left: -15px; z-index: 41; opacity: 0.9; transform: translate(116px, 41px); background-color: transparent;") If Not @error Then $StringMid = StringMid($oDoc, $oElement1, $oElement2 - $oElement1) $Split1 = StringSplit($StringMid, "src", 1) $Trim = StringLeft(StringTrimLeft($Split1[2], 3), StringInStr($Split1[2], '<') - 5) $Number = StringMid($Trim, StringInStr($Split1[2], 'w_ic_d_') + 4, 2) If $Day = 0 Then IniWrite($cfg, 'ImageID', 'today', $Number) Else IniWrite($cfg, 'ImageID', 'tomorrow', $Number) EndIf EndIf EndIf EndFunc ;==>_Icon ;============================================================================= Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Local $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiRoundCorners ;============================================================================= #Region ;Window Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize ;============================================================================= Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore ;============================================================================= Func Quit() TrayItemSetState($ExitItem, $TRAY_UNCHECKED) _GDIPlus_Shutdown() _IEQuit($oIE) $StartWinCheck = TrayItemGetState($WS) If $StartWinCheck = 65 Then IniWrite($cfg, 'Options', 'StartWithWin', 1) ElseIf $StartWinCheck = 68 Then IniWrite($cfg, 'Options', 'StartWithWin', 0) EndIf Exit EndFunc ;==>Quit #EndRegion ;Window ;============================================================================= Do ;Main Sleep(100) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;====================================================================================== Func StartWinChoose() $StartWinCheck = TrayItemGetState($WS) If $StartWinCheck = 68 Then StartWithWin() ElseIf $StartWinCheck = 65 Then RemFromStartWithWin() EndIf EndFunc ;==>StartWinChoose ;====================================================================================== Func StartWithWin() FileCreateShortcut(@AutoItExe, 'C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') If FileExists('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') Then TrayItemSetState($WS, $GUI_CHECKED) IniWrite($cfg, 'Options', 'StartWithWin', 1) MsgBox(64, '', 'Application setup to start with windows') Else TrayItemSetState($WS, $GUI_UNCHECKED) IniWrite($cfg, 'Options', 'StartWithWin', 0) MsgBox(64, '', 'Could not set the application to start with windows') EndIf EndFunc ;==>StartWithWin ;====================================================================================== Func RemFromStartWithWin() FileDelete('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') Sleep(100) If FileExists('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') Then TrayItemSetState($WS, $GUI_CHECKED) IniWrite($cfg, 'Options', 'StartWithWin', 1) MsgBox(64, '', 'Could not remove the application from the start of windows') Else TrayItemSetState($WS, $GUI_UNCHECKED) IniWrite($cfg, 'Options', 'StartWithWin', 0) MsgBox(64, '', 'Removed application from start of windows') EndIf EndFunc ;==>RemFromStartWithWin ;====================================================================================== Func CfgFolder() TrayItemSetState($CfgFldr, $TRAY_UNCHECKED) ShellExecute($InstallDir) EndFunc ;==>CfgFolder ;============================================================================= Func _Load() If FileExists('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') Then Local $aDetails = FileGetShortcut('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') If Not @error Then If $aDetails[0] <> @AutoItExe Then FileDelete('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') FileCreateShortcut(@AutoItExe, 'C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ipma.lnk') EndIf EndIf TrayItemSetState($WS, $GUI_CHECKED) IniWrite($cfg, 'Options', 'StartWithWin', 1) Else ;TrayItemSetState($WS, $GUI_UNCHECKED) IniWrite($cfg, 'Options', 'StartWithWin', 0) EndIf EndFunc ;==>_Load ;============================================================================= ipma.ico SVG.rar
  2. Yet another weather scrypt, but this one is working. All other that I search for aren not functioning. To get you City code go to weather.com and inside URL is code. this script parses XML from weather.com and shows to MSgBox and console. #cs Description: Weather XML from Weather.com. author: usmiv4o (just repaired old script) date: 29.7.2017 to get City code go to weather.com and copy City code from URL ;http://wxdata.weather.com/wxdata/weather/local/BUXX0005?cc=*&unit=m&dayf=1 <- URL for Sofia, Bulgaria, metric units #ce 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 = "BUXX0005" ;Sofia Bulgaria $input = "sofia" _GetWeather() $array = StringSplit($temp, " ") ;$temp = K2C($array[1]) $array = StringSplit($feels, " ") ;$feels = K2C($array[1]) $array = StringSplit($sunrise, " ") $sunrise = $array[1] $array = StringSplit($sunrise, ":") $sunrise = $array[1] $sunrise1 = $array[2] ;MsgBox(0,"sunset", $sunset) $array = StringSplit($sunset, " ") $sunset = $array[1] $array = StringSplit($sunset, ":") $sunset = $array[1] $sunset1 = $array[2] ; wind speed $ws = $ws * 1.6 $array = StringSplit($ws, ".") $ws = $array[1] ;$ws1 = $array[2] ;ConsoleWrite("Temperature now "&$temp& " C " & @CRLF _ ;& " Weather now "& $current & @CRLF &" wind speed " & K2C($ws) _ ;& "km/h." & @CRLF & " Humidity " &$hmid & " %" & @CRLF & " bar. pressure " & $bp & " hP" & @CRLF) ; convert Kelvins to Celsius Func K2C(ByRef $temp) $temp = ($temp - 32) * (5/9) ;converting to Celsius $temp = Round($temp, 2) ;round float point up to 2 -nd sign ;MsgBox(0, "K2C", $temp) Return $temp EndFunc ;Message Box with data Func Showy() MsgBox(0,"location ", $location) ConsoleWrite("location "& $location & @CRLF) MsgBox(0,"loc_time ", $loc_time) ConsoleWrite("loc_time "& $loc_time & @CRLF) MsgBox(0,"sunrise ", $sunrise &"."& $sunrise1) ConsoleWrite("sunrise "& $sunrise &"."& $sunrise1 & @CRLF) MsgBox(0,"sunset ", $sunset &"."& $sunset1) ConsoleWrite("sunset "& $sunset &"."& $sunset1 & @CRLF) MsgBox(0,"datetime ", $datetime) ConsoleWrite("datetime "& $datetime & @CRLF) MsgBox(0,"temp ", $temp & " C") ConsoleWrite("temp "& $temp & " C" & @CRLF) MsgBox(0,"feels ", $feels & "C") ConsoleWrite("feels "& $feels & "C" & @CRLF) MsgBox(0,"current ", $current) ConsoleWrite("current " & $current & @CRLF) MsgBox(0,"barometric pressure ", $bp & "hP") ConsoleWrite("barometric pressure "& $bp & "hP" & @CRLF) MsgBox(0,"bpd ", $bpd) ConsoleWrite("bpd " & $bpd & @CRLF) MsgBox(0,"wind speed ", $ws) ConsoleWrite("wind speed " & $ws & @CRLF) MsgBox(0,"wd wt ", $wd & " " & $wt& " km/h") ConsoleWrite("wd wt " & $wd & " " & $wt & " km/h" & @CRLF) MsgBox(0,"humidity ", $hmid & "%") ConsoleWrite("humidity " & $hmid & "%" & @CRLF) MsgBox(0,"visibility ", $vis & " km") ConsoleWrite("visibility " & $vis & " km " & @CRLF) MsgBox(0,"UV index", $uv & " (" & $uvt & ")") ConsoleWrite("UV index " & $uv & " (" & $uvt & ")" & @CRLF) MsgBox(0,"dewp", $dewp) ConsoleWrite("dewp " & $dewp & @CRLF) MsgBox(0,"mt", $mt) ConsoleWrite("mt " & $mt & @CRLF) EndFunc Func _GetWeather() $oXml = ObjCreate("Msxml2.DOMDocument.3.0") $oXml.async=0 $oXml.Load("http://wxdata.weather.com/wxdata/weather/local/BUXX0005?cc=*&unit=m&dayf=1") $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://wxdata.weather.com/wxdata/weather/local/" & $code & "?cc=*&unit=m&dayf=1") $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 ; sunrise ;ConsoleWrite($sunrise & @CRLF) Case $oXmlnode2.nodename = "suns" $sunset = $oxmlnode2.text ; sunset ;ConsoleWrite($sunset & @CRLF) EndSelect Next Case $oXmlnode.nodename = "dayf" For $oXmlnode2 in $oXmlnode.Childnodes Select Case $oXmlnode2.nodename = "hi" $hi = $oXmlnode2.text Case $oXmlnode2.nodename = "low" $low = $oXmlnode2.text EndSelect Next Case $oxmlnode.nodename = "cc" For $oxmlnode2 In $oxmlnode.childnodes Select Case $oxmlnode2.nodename = "lsup" ;<lsup>7/28/17 7:00 AM EEST</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 ;windspeed miles 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 ;humidity Case $oxmlnode2.nodename = "vis" $vis = $oxmlnode2.text ;visibility Case $oxmlnode2.nodename = "uv" For $oxmlnode3 in $oxmlnode2.childnodes; ULTRAVIOLET INDEX 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 Showy() attached weather.au3 and sample XML BUXX0005.xml Weather.au3
×
×
  • Create New...