retrieves current conditions info from bbc weather feed (xml). makes toolbar icon accordingly and tooltip with bit more info and temperature in celsius.. clicking on the toolbar button will open the bbc weather page for the configured citry. also the possibility of expanding with 5 day forecasts with release of 1.5.4
2 versions for nt and 9x
nt:
http://kmext.sourceforge.net/files/weathermanNT.7z
9x:
http://kmext.sourceforge.net/files/weatherman9x.7z
to setup your city you will need to find the code for it, bbc uses unique numerical code without letters unlike weather.com.. either right click on the button or tools>weather bar> and select find city code
in the prompt enter name of city or country+ city or just country and click ok
this will open the bbc weather search - cities with unique names may open their weather pages directly without search-
click on the city you want
it will open its weather page..the last digits in the url address is the code.. some cities have 1 digit code (uk) and up to 4 digits
now click on the weatherbar menu again and select enter city code this time
in the prompt enter the code and click ok
you will get prompt to restart..you don't have to if you don't want to restart right away and just click no..but your city won't appear till next time km is fired
on few occasions, the icon and tooltip will show n/a not available..that's not a bug..just bbc haven't updated their latest observations yet
examples: (i can't find snow or thunderstorms)
sources:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# ---------- weatherbar(bbc weather xml)-------------------------------
#-- do not edit anything below this line-----------
$weathercity=(" for honolulu united states of america");
$weathertemp=(" 25 °C");
$weathercond=(": clear sky");
$weatherpend=("current weather conditions");
$weathertip=($weatherpend.$weathercity.$weathercond.$weathertemp);
weathersite{
open("http://news.bbc.co.uk/weather/forecast/265"
}
#-- do not edit anything above this line-----------
$weatherman=getfolder(RootFolder)."\\macros";
$skins=getfolder(RootFolder)."\\skins\\default";
$kbinary=getfolder(RootFolder)."\\k-meleon.exe";
$_profile_path=getfolder(ProfileFolder);
weathercode{
$code = prompt("Enter city name :", "Get weather code", $code);
$code == "" ? "" : opentab("http://www.bbc.co.uk/cgi-perl/weather/search/new_search.pl?search_query=" .$code);
}
inputcode{
$code = prompt("examples: marseille=41 hamburg=49 larnaca=234 alexandria=116", "Enter city code :", $code);
$code == "" ? "" : exec($weatherman."\\weatherman.exe \"".$code."\" \"".$kbinary."\" \"".$_profile_path."\"");
}
getweather{
exec($weatherman."\\weatherman.exe \"".$skins."\"");
}
weatherman_BuildMenu{
setmenu(WebServices,popup,"Weather Bar",5);
setmenu("Weather Bar",macro,"Find City Code",weathercode);
setmenu("Weather Bar",macro,"Enter City Code",inputcode);
}
_weatherbar_BuildToolbar{
pluginmsg(toolbars,"AddToolbar","Weather Bar,16,16","");
$button1=(pluginmsg(toolbars,"AddButton","Weather Bar,Weather Bar,macros("."weathersite"."),"."Weather Bar".",".$weathertip.",16,16,"."wcondition.bmp",""));
}
$OnInit=$OnInit."getweather;";
$OnQuit=$OnQuit."getweather;";
$OnInit=$OnInit."weatherman_BuildMenu;";
$OnSetup=$OnSetup."_weatherbar_BuildToolbar;";
#-----------------------------------------------------------------
$macroModules=$macroModules."weatherbar;";
; AutoIt Version: 3.3.0
; Language: doubledutch
; Platform: Win9x/NT
; Author: yannis kargas
; Script Function: lottashit
#NoTrayIcon
#include <File.au3>
#include <Misc.au3>
;if _Singleton("weatherman",0) = 0 Then
;exit
;endif
;checkini()
if fileexists(@ScriptDir & "\weatherman.ini") Then
checkmacro()
else
MsgBox(48, "bastard", "missing weatherman.ini, please reinstall the weatherbar extension. ")
exit
endif
func checkmacro()
if fileexists(@ScriptDir & "\weatherbar.kmm") Then
resume()
else
MsgBox(48, "bastard", "missing weatherbar.kmm, please reinstall the weatherbar extension. ")
exit
endif
endfunc
$bbcweather=("http://news.bbc.co.uk/weather/forecast/"
$weathercity=("$weathercity=");
$weathertemp=("$weathertemp=");
$weathercond=("$weathercond");
$macro=(@ScriptDir & "\weatherbar.kmm")
$clearsky=(@ScriptDir & "\weathericons\clearsky.bmp")
$sunny=(@ScriptDir & "\weathericons\sunny.bmp")
$sunnyintervals=(@ScriptDir & "\weathericons\pcloudy.bmp")
$cloudy=(@ScriptDir & "\weathericons\cloudy.bmp")
$pcloudy=(@ScriptDir & "\weathericons\pcloudy.bmp")
$wcloudy=(@ScriptDir & "\weathericons\pcloudy.bmp")
$greycloud=(@ScriptDir & "\weathericons\greycloud.bmp")
$drizzle=(@ScriptDir & "\weathericons\drizzle.bmp")
$showers=(@ScriptDir & "\weathericons\showers.bmp")
$rain=(@ScriptDir & "\weathericons\rain.bmp")
$sleet=(@ScriptDir & "\weathericons\sleet.bmp")
$snow=(@ScriptDir & "\weathericons\snow.bmp")
$mist=(@ScriptDir & "\weathericons\mist.bmp")
$haze=(@ScriptDir & "\weathericons\haze.bmp")
$fog=(@ScriptDir & "\weathericons\fog.bmp")
$thunder=(@ScriptDir & "\weathericons\thunder.bmp")
$notav=(@ScriptDir & "\weathericons\na.bmp")
$pendxml=(@TempDir & "\current.xml")
func resume()
if $cmdline[0]=0 then
exit
elseif $cmdline[0]=1 then
findweather()
else
setweather()
endif
endfunc
func setweather()
;reference:http://newsrss.bbc.co.uk/weather/forecast/116/ObservationsRSS.xml
$isvalid=StringIsdigit($cmdline[1])
if $isvalid=1 then
$rssaddress=("http://newsrss.bbc.co.uk/weather/forecast/" & $cmdline[1] & "/ObservationsRSS.xml")
IniWrite(@ScriptDir & "\weatherman.ini", "weather", 1, $rssaddress)
sleep(40)
confirm()
else
MsgBox(48, "user error", "Invalid city code. city codes must consist of digits only. ")
exit
endif
endfunc
func confirm()
$ask=MsgBox(32+4, "K-Meleon Weatherbar", "K-Meleon needs to be restarted for new settings. Restart K-Meleon? ")
If $ask=7 Then
Exit
Else
loadercheck()
endif
endfunc
func loadercheck()
if procesS E Xists("loader.exe") then
restartloader()
else
restartkm()
endif
endfunc
func restartkm()
While ProcesS E Xists("k-meleon.exe")
WinClose("[CLASS:KMeleon Browser Window]", "");
sleep(400);
If WinActive("K-Meleon") Then
Send("{Enter}")
EndIf
Wend
sleep(5888)
sleep(400)
Run($CmdLine[2])
endfunc
Func restartloader()
$findthefucker=StringTrimRight($CmdLine[2], 12)
$fucker=($findthefucker & "loader.exe")
$prefspath=($CmdLine[3] & "\prefs.js")
$cleanclose=("user_pref" & "(" &"""" & "kmeleon.plugins.sessions.cleanShutdown" & """" & "," & " true" & ");")
While WinExists("[CLASS:KMeleon Browser Window]", "")
WinClose("[CLASS:KMeleon Browser Window]", "");
sleep(400);
If WinActive("K-Meleon") Then
Send("{Enter}")
EndIf
Wend
ProcessClose("loader.exe")
sleep(44)
ProcessClose("k-meleon.exe")
sleep(88)
FileWriteLine($prefspath, $cleanclose)
sleep(5888)
Run($CmdLine[2])
sleep(4888)
Run($fucker)
EndFunc
func findweather()
$city=IniRead(@ScriptDir & "\weatherman.ini", "weather", "1", "default")
;MsgBox(4096, "Test", $city)
$pendxml=(@TempDir & "\current.xml")
InetGet($city, $pendxml, 1, 0)
sleep(40)
cityname()
endfunc
func cityname()
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$cityxml=filereadline($pendxml, 5)
$pendname1=StringTrimLeft($cityxml, 49)
$pendname2=StringTrimright($pendname1, 8)
$pendname3=StringReplace($pendname2, ",", "")
$pendname4=StringLower($pendname3)
$citystring=("$weathercity=(" & """" & $pendname4 & """" &");")
_FileWriteToLine($macro, 7, $citystring, 1)
temprature()
endfunc
func temprature()
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$tempxml=filereadline($pendxml, 19)
$pendtemp1=StringMid($tempxml, 26, 4)
$pendtemp2=StringReplace($pendtemp1, "&", "")
$pendtemp3=($pendtemp2 & " °C")
$tempstring=("$weathertemp=(" & """" & $pendtemp3 & """" &");")
_FileWriteToLine($macro, 8, $tempstring, 1)
setweatherhome()
endfunc
func setweatherhome()
$macro=(@ScriptDir & "\weatherbar.kmm")
$bbcweather=("http://news.bbc.co.uk/weather/forecast/"
$fuck=IniRead(@ScriptDir & "\weatherman.ini", "weather", "1", "default")
$shitter = StringMid($fuck, 43, 4)
$shit1=StringReplace($shitter, "/", "")
$shit2=StringReplace($shit1, "O", "")
$shit3=StringReplace($shit2, "b", "")
$shit4=StringReplace($shit3, "s", "")
$finalcrap=($bbcweather & $shit4)
$tempstring=("open(" & """" & $finalcrap & """" &");")
_FileWriteToLine($macro, 14, $tempstring, 1)
sunnyintervals()
endfunc
func sunnyintervals()
$sunnyintervals=(@ScriptDir & "\weathericons\pcloudy.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)sunny intervals")
if $condition=1 then
;MsgBox(4096, "Test", "nissan sunny")
$condstring=("$weathercond=(" & """" & ": sunny intervals" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($sunnyintervals, $destbmp, 1)
exit
else
sunny()
;MsgBox(4096, "Test", "oh crap")
endif
endfunc
func sunny()
$sunny=(@ScriptDir & "\weathericons\sunny.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)sunny")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": sunny" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($sunny, $destbmp, 1)
exit
else
partly()
endif
endfunc
func partly()
$pcloudy=(@ScriptDir & "\weathericons\pcloudy.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)sunny")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": sunny" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($pcloudy, $destbmp, 1)
exit
else
white()
endif
endfunc
func white()
$cloudy=(@ScriptDir & "\weathericons\cloudy.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)white")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": white clouds" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($cloudy, $destbmp, 1)
exit
else
grey()
endif
endfunc
func grey()
$greycloud=(@ScriptDir & "\weathericons\greycloud.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)grey")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": grey clouds" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($greycloud, $destbmp, 1)
exit
else
cloudy()
endif
endfunc
func cloudy()
$cloudy=(@ScriptDir & "\weathericons\cloudy.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)cloudy")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": cloudy" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($cloudy, $destbmp, 1)
exit
else
thunder()
endif
endfunc
func thunder()
$thunder=(@ScriptDir & "\weathericons\thunder.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)thunder")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": thunder storms" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($thunder, $destbmp, 1)
exit
else
light()
endif
endfunc
func light()
$showers=(@ScriptDir & "\weathericons\showers.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)light")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": light rain" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($showers, $destbmp, 1)
exit
else
heavy()
endif
endfunc
func heavy()
$rain=(@ScriptDir & "\weathericons\rain.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)heavy")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": heavy rain" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($rain, $destbmp, 1)
exit
else
rain()
endif
endfunc
func rain()
$rain=(@ScriptDir & "\weathericons\rain.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)rain")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": rain" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($rain, $destbmp, 1)
exit
else
drizzle()
endif
endfunc
func drizzle()
$drizzle=(@ScriptDir & "\weathericons\drizzle.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)drizzle")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": drizzle" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($drizzle, $destbmp, 1)
exit
else
showers()
endif
endfunc
func showers()
$showers=(@ScriptDir & "\weathericons\showers.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)showers")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": light showers" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($showers, $destbmp, 1)
exit
else
ice()
endif
endfunc
func ice()
$sleet=(@ScriptDir & "\weathericons\sleet.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)ice")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": sleet" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($sleet, $destbmp, 1)
exit
else
sleet()
endif
endfunc
func sleet()
$sleet=(@ScriptDir & "\weathericons\sleet.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)sleet")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": sleet" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($sleet, $destbmp, 1)
exit
else
snow()
endif
endfunc
func snow()
$snow=(@ScriptDir & "\weathericons\snow.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)snow")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": snow" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($snow, $destbmp, 1)
exit
else
clear()
endif
endfunc
func clear()
$clearsky=(@ScriptDir & "\weathericons\clearsky.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)clear sky")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": clear sky" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($clearsky, $destbmp, 1)
exit
else
mist()
endif
endfunc
func mist()
$mist=(@ScriptDir & "\weathericons\mist.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)mist")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": mist" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($mist, $destbmp, 1)
exit
else
fog()
endif
endfunc
func fog()
$fog=(@ScriptDir & "\weathericons\fog.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)fog")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": fog" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($fog, $destbmp, 1)
exit
else
haze()
endif
endfunc
func haze()
$haze=(@ScriptDir & "\weathericons\haze.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$pendxml=(@TempDir & "\current.xml")
$readxml=filereadline($pendxml, 17)
$condition=StringRegExp($readxml, "(?i)haze")
if $condition=1 then
$condstring=("$weathercond=(" & """" & ": haze" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($haze, $destbmp, 1)
exit
else
notav()
endif
endfunc
func notav()
$notav=(@ScriptDir & "\weathericons\na.bmp")
$macro=(@ScriptDir & "\weatherbar.kmm")
$condstring=("$weathercond=(" & """" & ": not available" & """" &");")
_FileWriteToLine($macro, 9, $condstring, 1)
$destbmp=($cmdline[1] & "\wcondition.bmp")
FileCopy($notav, $destbmp, 1)
exit
endfunc
exit