tglogo.png

Downloading File

Filename: Weather Script w/5-day Forecast

;Wunderground Weather Script by Ford_Lawnmower irc://irc.mindforge.org
dialog CurrentConditions {
  title "Current Conditions"
  size -1 -1 184 136
  option dbu
  text "", 1, 0 1 193 8
  icon 2, 8 16 23 23
  text "", 3, 40 24 41 16, center
  text "Humidity:", 4, 8 48 33 8
  text "Dew Point:", 5, 8 56 33 8
  text "Wind:", 6, 8 64 33 8
  text "Wind Gust:", 7, 8 72 33 8
  text "Pressure:", 8, 8 80 33 8
  text "Heat Index:", 9, 8 88 33 8
  text "Visibility:", 10, 8 96 33 8
  text "UV:", 11, 8 104 33 8
  text "Clouds:", 12, 8 112 33 8
  text "Elevation", 13, 8 120 33 8
  text "", 14, 40 48 49 8
  text "", 15, 40 56 49 8
  text "", 16, 40 64 49 8
  text "", 17, 40 72 49 8
  text "", 18, 40 80 49 8
  text "", 19, 40 88 49 8
  text "", 20, 40 96 49 8
  text "", 21, 40 104 49 8
  text "", 22, 40 112 109 8
  text "", 23, 40 120 49 8
  icon 24, 104 16 63 63
  button "5-Day Forecast", 25, 96 123 41 12, disable
  button "Close", 26, 144 123 37 12, cancel
  text "Enter City State or Zip Code", 27, 96 88 81 8, center
  edit "", 28, 96 96 82 10, autohs
  button "Search", 29, 152 107 29 12
  text "", 30, 8 128 81 8
}
On *:Dialog:CurrentConditions:init:*: { Wunderground Cincinnati Ohio }
On *:Dialog:CurrentConditions:Close:*: {
  hfree WundergroundDialog
}
On *:Dialog:CurrentConditions:Sclick:25: {
  if ($dialog(5-DayForecast)) {
    did -a 5-DayForecast 1 $hget(WundergroundDialog,location)
    var %5-days = $gettok($hget(WundergroundDialog,days),0,32)
    while (%5-days) {
      did -a 5-DayForecast $calc(%5-days + 1) $gettok($hget(WundergroundDialog,days),%5-days,32)
      did -g 5-DayForecast $calc(%5-days + 6) $+(Wunderground\,$nopath($hget(WundergroundDialog,$+(day,%5-days,pic))))
      did -a 5-DayForecast $calc(%5-days + 11) $+($hget(WundergroundDialog,$+(day,%5-days,high)),|,$hget(WundergroundDialog,$+(day,%5-days,low)))
      did -a 5-DayForecast $calc(%5-days + 16) $hget(WundergroundDialog,$+(day,%5-days,condition))         
      dec %5-days
    }
  }
  else { 5-Day }
}
On *:Dialog:CurrentConditions:Sclick:29: {
  if ($did(CurrentConditions,28).text) { Wunderground $did(CurrentConditions,28).text }
  else { did -a CurrentConditions 30 No search Item!! | .timer 1 3 did -a CurrentConditions 30 }
}
dialog 5-DayForecast {
  title "5-Day Forecast"
  size -1 -1 208 64
  option dbu
  text "", 1, 0 0 209 8, center
  text "", 2, 4 8 41 8, center
  text "", 3, 44 8 41 8, center
  text "", 4, 84 8 41 8, center
  text "", 5, 124 8 41 8, center
  text "", 6, 164 8 41 8, center
  icon 7, 16 16 15 15
  icon 8, 56 16 15 15
  icon 9, 96 16 15 15
  icon 10, 136 16 15 15
  icon 11, 176 16 15 15
  text "", 12, 4 32 41 8, center
  text "", 13, 44 32 41 8, center
  text "", 14, 84 32 41 8, center
  text "", 15, 124 32 41 8, center
  text "", 16, 164 32 41 8, center
  text "", 17, 4 40 41 24, center
  text "", 18, 44 40 41 24, center
  text "", 19, 84 40 41 24, center
  text "", 20, 124 40 41 24, center
  text "", 21, 164 40 41 24, center
}
On *:Dialog:5-DayForecast:init:*: {
  did -a 5-DayForecast 1 $hget(WundergroundDialog,location)
  var %5-days = $gettok($hget(WundergroundDialog,days),0,32)
  while (%5-days) {
    did -a 5-DayForecast $calc(%5-days + 1) $gettok($hget(WundergroundDialog,days),%5-days,32)
    did -g 5-DayForecast $calc(%5-days + 6) $+(Wunderground\,$nopath($hget(WundergroundDialog,$+(day,%5-days,pic))))
    did -a 5-DayForecast $calc(%5-days + 11) $+($hget(WundergroundDialog,$+(day,%5-days,high)),|,$hget(WundergroundDialog,$+(day,%5-days,low)))
    did -a 5-DayForecast $calc(%5-days + 16) $hget(WundergroundDialog,$+(day,%5-days,condition))         
    dec %5-days
  }
}
alias -l Wunderground.timeout {
  if (%Wunder.chan != dialog) { .msg %Wunder.chan Nothing Found... :( | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
  else { did -a CurrentConditions 30 Nothing Found!! | .timer 1 3 did -a CurrentConditions 30 }
  Wunderground.clear
}
alias -l Wunderground.clear {
  sockclose %Wunder.name
  unset %getpic.*
  unset %Wunder*
  .timer-Wunderground off
  halt
}
alias Wunderground {
  set %Wunder.nick $me
  set %Wunder.chan dialog
  set %Wunder.name $+(Wunderground,%Wunder.chan)
  if ($hget(%Wunder.name)) { hfree %Wunder.name }
  if ($dialog(CurrentConditions)) { did -b CurrentConditions 25 }
  hmake %Wunder.name 5
  sockclose $+(Wunderground,%Wunder.chan) 
  set %Wunderurl $+(/cgi-bin/findweather/getForecast?query=,$replace($1-,$chr(32),$+(%,20)),&wuSelect=WEATHER)
  set %Wundersite www.wunderground.com
  sockopen %Wunder.name %Wundersite 80
  .timer-Wunderground 1 10 Wunderground.timeout
}
#Wunderground.trigger on
on *:TEXT:!Forecast*:# {
  if (%Wunder.inuse == 1) { .notice $nick Sorry, But Somebody else is already looking up their Weather. | halt }
  set %Wunder.inuse 1
  set %Wunder.nick $nick
  set %Wunder.chan $chan
  set %Wunder.name $+(Wunderground,%Wunder.chan)
  if (!$hget(%Wunder.name)) { hmake %Wunder.name 5 }
  sockclose %Wunder.name 
  set %Wunderurl $+(/cgi-bin/findweather/getForecast?query=,$replace($2-,$chr(32),$+(%,20)),&wuSelect=WEATHER)
  set %Wundersite www.wunderground.com
  sockopen $+(Wunderground,$chan) %Wundersite 80
  .msg $chan Weather Search in Progress. Please Wait.....
  .timer-Wunderground 1 10 Wunderground.timeout
}
#Wunderground.trigger end
on *:sockopen:Wunderground*: {
  sockwrite -n $sockname GET %Wunderurl HTTP/1.1
  sockwrite -n $sockname Host: %Wundersite $+ $CRLF $+ $CRLF
}
on *:sockread:Wunderground*: {
  if ($sockerr > 0) { echo -a >Socket Error< |  Wunderground.clear }
  else {
    var %Wundervar |  sockread %Wundervar
    if (Scroll down to view a list of all all cities isin %Wundervar) {
      if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Country match. Be more Specific. | .timer 1 3 did -a CurrentConditions 30 }
      else { .msg %Wunder.chan You searched for a Country. Be more specific. | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
      Wunderground.clear 
    }
    if (Click on a column heading to sort this information isin %Wundervar) {
      if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Be more Specific. | .timer 1 3 did -a CurrentConditions 30 }
      else { .msg %Wunder.chan Too many results! Be more specific. | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
      Wunderground.clear 
    }
    if (There has been an error isin %Wundervar) {
      if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Location Doesn't exist | .timer 1 3 did -a CurrentConditions 30 }
      else { .msg %Wunder.chan Location Doesn't exist!! | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
      Wunderground.clear 
    }
    if (<div id="curcondbox"> isin %Wundervar) { set %Wunder.Box On }
    if (5-Day Forecast isin %Wundervar) && ($dialog(CurrentConditions)) && (%Wunder.Chan == dialog) {
      hadd %Wunder.name 5-Day On
      did -e CurrentConditions 25
    }
    if ($between(%Wundervar,<img src="," height="140",1)) {
      if (jpg isin $right($between(%Wundervar,<img src="," height="140",1),3)) {
        hadd %Wunder.name radarlink $between(%Wundervar,<img src="," height="140",1)
        getrad $hget(%wunder.name,radarlink) $nopath($hget(%wunder.name,radarlink))
        if ($hget(%Wunder.name,radarlink)) && (%wunder.chan == dialog) {
          .timer 1 5 did -g Currentconditions 24 $+(Wunderground\,$nopath($hget(%Wunder.name,radarlink))) 
        }
      } 
      else {
        hadd %Wunder.name radarlink  temppic.gif
        getrad $between(%Wundervar,<img src="," height="140",1) temppic.gif
        if (%wunder.chan == dialog) {
          if ($hget(%Wunder.name,radarlink)) { .timer 1 5 did -g Currentconditions 24 $+(Wunderground\,temppic.gif) }
        }  
      }
    }
    if (%Wunder.Box == On) {
      if (Humidity: isin %Wundervar) { set %Wunder.Humidity On }
      if (Dew Point: isin %Wundervar) { set %Wunder.dewpoint On }
      if (Wind: isin %Wundervar) { set %Wunder.wind On }
      if (Wind Gust: isin %Wundervar) { set %Wunder.windgust On }
      if (Pressure: isin %Wundervar) { set %Wunder.pressure On }
      if (Heat Index: isin %Wundervar) { set %Wunder.heatindex On }
      if (Visibility: isin %Wundervar) { set %Wunder.visibility On }
      if (UV: isin %Wundervar) { set %Wunder.UV On }
      if (Clouds: isin %Wundervar) { set %Wunder.clouds On }
      if (Elevation: isin %Wundervar) { set %Wunder.elevation On }
      if ($between(%Wundervar,<div class="subG b">,</div>,1)) {
        hadd %Wunder.name location $between(%Wundervar,<div class="subG b">,</div>,1)
      }
      if (<span class="nobr"><span class="b"> isin %Wundervar) &&  (!$hget(%Wunder.name,temperature)) {
        hadd %Wunder.name temperature $deg($httpstrip(%Wundervar))
      }
      if ($between(%Wundervar,<td class="vaM taC"><img src="," width="42",1)) {
        hadd %Wunder.name ConditionLink $between(%Wundervar,<td class="vaM taC"><img src="," width="42",1)
        getpik $hget(%Wunder.name,Conditionlink) $nopath($hget(%Wunder.name,Conditionlink))
      }
      if ($between(%Wundervar,<div class="b" style="font-size: 14px;">,</div>,1)) {
        hadd %Wunder.name condition $between(%Wunder,<div class="b" style="font-size: 14px;">,</div>,1)
      }
      if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.elevation) {
        hadd %Wunder.name elevation $httpstrip(%Wundervar)
        unset %Wunder.elevation
        unset %Wunder.Box
      }      
      if ($between(%Wundervar,<b>,</b>,1)) && (%Wunder.clouds) {
        hadd %Wunder.name clouds $between(%Wundervar,<b>,</b>,1)
        unset %Wunder.clouds
      }
      if ($between(%Wundervar,<td class="b">,</td>,1)) && (%Wunder.UV) {
        hadd %Wunder.name UV $httpstrip(%Wundervar)
        unset %Wunder.UV
      }
      if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.visibility) {
        hadd %Wunder.name visibility $httpstrip(%Wundervar)
        unset %Wunder.visibility
      }      
      if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.heatindex) {
        hadd %Wunder.name heatindex $deg($httpstrip(%Wundervar))
        unset %Wunder.heatindex
      }      
      if ($between(%Wundervar,<b>,</b>,1)) && (%Wunder.pressure) {
        hadd %Wunder.name pressure $httpstrip(%Wundervar)
        unset %Wunder.pressure
      }
      if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.windgust) {
        hadd %Wunder.name windgust $httpstrip(%Wundervar)
        unset %Wunder.windgust
      }      
      if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.wind) {
        hadd %Wunder.name wind $httpstrip(%Wundervar)
        unset %Wunder.wind
      }      
      if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.dewpoint) {
        hadd %Wunder.name dewpoint $deg($httpstrip(%Wundervar))
        unset %Wunder.dewpoint
      }
      if ($between(%Wundervar,<td class="full b"><span class="pwsrt",</nobr></span></td>,1)) && (%Wunder.humidity) {
        hadd %Wunder.name humidity $httpstrip(%Wundervar)
        unset %Wunder.humidity
      }
    }
    if (<tr class="wHover noBorder"> isin %Wundervar) { set %Wunder.5-day On | unset %Wunder.Box }
    if (<td class="taC" style="width: isin %Wundervar) && (</td> isin %Wundervar) {
      hadd %Wunder.name days $hget(%Wunder.name,days) $httpstrip(%Wundervar)
    }
    if (<td>Enable</td> isin %Wundervar) {
      if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) {
        if ($hget(%Wunder.name,location)) { did -a Currentconditions 1 $hget(%Wunder.name,location) }
        if ($hget(%Wunder.name,temperature)) { did -a Currentconditions 3 $hget(%Wunder.name,temperature)  }
        if ($hget(%Wunder.name,humidity)) { did -a Currentconditions 14 $hget(%Wunder.name,humidity) }
        if ($hget(%Wunder.name,dewpoint)) { did -a Currentconditions 15 $hget(%Wunder.name,dewpoint) }
        if ($hget(%Wunder.name,wind)) { did -a Currentconditions 16 $hget(%Wunder.name,wind) }
        if ($hget(%Wunder.name,windgust)) { did -a Currentconditions 17 $hget(%Wunder.name,windgust) }
        if ($hget(%Wunder.name,pressure)) { did -a Currentconditions 18 $hget(%Wunder.name,pressure) }
        if ($hget(%Wunder.name,heatindex)) { did -a Currentconditions 19 $hget(%Wunder.name,heatindex) }
        if ($hget(%Wunder.name,visibility)) { did -a Currentconditions 20 $hget(%Wunder.name,visibility) }
        if ($hget(%Wunder.name,UV)) { did -a Currentconditions 21 $hget(%Wunder.name,UV) }
        if ($hget(%Wunder.name,clouds)) { did -a Currentconditions 22 $hget(%Wunder.name,clouds) }
        if ($hget(%Wunder.name,elevation)) { did -a Currentconditions 23 $hget(%Wunder.name,elevation) }
        if ($hget(%Wunder.name,conditionlink)) { .timer 1 5 did -g Currentconditions 2 $+(Wunderground\,$nopath($hget(%Wunder.name,conditionlink))) }
      }
      else {
        .msg %wunder.chan $colorz(Weather for $hget(%Wunder.name,location)  Temperature: $hget(%Wunder.name,temperature)  Humidity: $hget(%Wunder.name,humidity) $&
          Dew Point: $hget(%Wunder.name,dewpoint)  Wind: $hget(%Wunder.name,wind)  Pressure: $hget(%Wunder.name,pressure)  Heat Index: $&
          $hget(%Wunder.name,heatindex)  Visibility: $hget(%Wunder.name,visibility)  Clouds: $hget(%Wunder.name,clouds))
      }
    }
    if (<td class="full">Forecast for isin %Wundervar) {
      if (%Wunder.chan != dialog) { hfree %Wunder.name }
      Wunderground.clear
    }
    if (%Wunder.5-day == On) {
      if (<tr class="wHover noBorder"> isin %Wundervar) && ($hget(%Wunder.name,day5pic)) {
        if (%Wunder.chan == dialog) && $dialog(CurrentConditions) {
          WunderGround.Clear
        }
        else {
          .msg %wunder.chan $colorz(5-Day Forecast - $gettok($hget(%Wunder.name,days),1,32)  $hget(%Wunder.name,day1high)  $hget(%Wunder.name,day1low) $&
            $hget(%Wunder.name,day1condition) - $gettok($hget(%Wunder.name,days),2,32)  $hget(%Wunder.name,day2high)  $hget(%Wunder.name,day2low) $&
            $hget(%Wunder.name,day2condition) - $gettok($hget(%Wunder.name,days),3,32)  $hget(%Wunder.name,day3high)  $hget(%Wunder.name,day3low) $&
            $hget(%Wunder.name,day3condition) .)
          .msg %wunder.chan $colorz(5-Day Forecast - $gettok($hget(%Wunder.name,days),4,32)  $hget(%Wunder.name,day4high)  $hget(%Wunder.name,day4low) $&
            $hget(%Wunder.name,day4condition) - $gettok($hget(%Wunder.name,days),5,32)  $hget(%Wunder.name,day5high)  $hget(%Wunder.name,day5low) $&
            $hget(%Wunder.name,day5condition) .) 
          hfree %Wunder.name
        }
        wunderground.clear
      }
      if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day5pic)) && ($hget(%Wunder.name,day4pic)) {
        hadd %Wunder.name day5pic $between(%Wundervar,<div><img src="," alt=",1)
        hadd %Wunder.name day5condition $between(%Wundervar,alt="," width="42",1)
        .timer 1 5 getpic $hget(%Wunder.name,day5pic) $nopath($hget(%Wunder.name,day5pic))
      }
      if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day5high)) && ($hget(%Wunder.name,day4high)) {
        hadd %Wunder.name day5high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
      }
      if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day5low)) && ($hget(%Wunder.name,day4low)) {
        hadd %Wunder.name day5low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
      }
      if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day4pic)) && ($hget(%Wunder.name,day3pic)) {
        hadd %Wunder.name day4pic $between(%Wundervar,<div><img src="," alt=",1)
        hadd %Wunder.name day4condition $between(%Wundervar,alt="," width="42",1)
        .timer 1 4 getpic $hget(%Wunder.name,day4pic) $nopath($hget(%Wunder.name,day4pic))
      }
      if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day4high)) && ($hget(%Wunder.name,day3high)) {
        hadd %Wunder.name day4high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
      }
      if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day4low)) && ($hget(%Wunder.name,day3low)) {
        hadd %Wunder.name day4low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
      }
      if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day3pic)) && ($hget(%Wunder.name,day2pic)) {
        hadd %Wunder.name day3pic $between(%Wundervar,<div><img src="," alt=",1)
        hadd %Wunder.name day3condition $between(%Wundervar,alt="," width="42",1)
        .timer 1 3 getpic $hget(%Wunder.name,day3pic) $nopath($hget(%Wunder.name,day3pic))
      }
      if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day3high)) && ($hget(%Wunder.name,day2high)) {
        hadd %Wunder.name day3high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
      }
      if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day3low)) && ($hget(%Wunder.name,day2low)) {
        hadd %Wunder.name day3low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
      }
      if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day2pic)) && ($hget(%Wunder.name,day1pic)) {
        hadd %Wunder.name day2pic $between(%Wundervar,<div><img src="," alt=",1)
        hadd %Wunder.name day2condition $between(%Wundervar,alt="," width="42",1)
        .timer 1 2 getpic $hget(%Wunder.name,day2pic) $nopath($hget(%Wunder.name,day2pic))
      }
      if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day2high)) && ($hget(%Wunder.name,day1high)) {
        hadd %Wunder.name day2high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
      }
      if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day2low)) && ($hget(%Wunder.name,day1low)) {
        hadd %Wunder.name day2low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
      }
      if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day1pic)) {
        hadd %Wunder.name day1pic $between(%Wundervar,<div><img src="," alt=",1)
        hadd %Wunder.name day1condition $between(%Wundervar,alt="," width="42",1)
        .timer 1 1 getpic $hget(%Wunder.name,day1pic) $nopath($hget(%Wunder.name,day1pic))
      }
      if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day1high)) {
        hadd %Wunder.name day1high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1)   )
      }
      if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day1low)) {
        hadd %Wunder.name day1low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
      }
    }
  }
}
alias -l deg { 
  return $replace($1-,&deg;,$chr(186),&#176;,$chr(176)) $iif(F isin $1-,$FtoC($remove($1-,&deg;,&#176;,F)),$CtoF($remove($1-,&deg;,&#176;,C)))
}
Alias  -l GetPic {
  if ($sock($+(getpic,$2))) { return }
  if ($isfile($+(wunderground\,$2))) { return }
  set %GetPic.Site $gettok($remove($1,http://),1,47)
  set %GetPic.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  set %GetPic.PicName $2
  if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
  sockopen $+(GetPic,%getpic.picname) %getpic.site 80
}
On *:sockopen:GetPic*:{
  sockwrite -nt $sockname GET %getpic.url HTTP/1.0
  sockwrite $sockname Host: %getpic.site $+ $crlf $+ $crlf
}
On *:sockread:GetPic*:{
  if (!$sock($sockname).mark) {
    var %GetPic.var | sockread %GetPic.var
    if (%GetPic.var == $null) { sockmark $sockname 1 }
  }
  else {
    sockread &picture 
    bwrite $qt($+($mircdir,wunderground\,%getpic.picname)) -1 -1 &picture
  }
}
Alias -l GetPik {
  if ($isfile($+(wunderground\,$2))) { return }
  sockclose GetPik
  set %GetPik.Site $gettok($remove($1,http://),1,47)
  set %GetPik.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  set %GetPik.PicName $2
  if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
  sockopen GetPik %GetPik.site 80
}
On *:sockopen:GetPik:{
  sockwrite -nt $sockname GET %GetPik.url HTTP/1.0
  sockwrite $sockname Host: %GetPik.site $+ $crlf $+ $crlf
}
On *:sockread:GetPik:{
  if (!$sock($sockname).mark) {
    var %GetPik.var | sockread %GetPik.var
    if (%GetPik.var == $null) { sockmark $sockname 1 }
  }
  else {
    sockread &pict 
    bwrite $qt($+($mircdir,wunderground\,%GetPik.picname)) -1 -1 &pict
  }
}
On *:sockclose:GetPik:{
  unset %GetPik.*
}
alias -l CurrentConditions {
  if ($dialog(CurrentConditions)) { dialog -v CurrentConditions CurrentConditions }
  else { dialog -m CurrentConditions CurrentConditions }
}
alias -l 5-Day {
  if ($dialog(5-DayForecast)) { dialog -v 5-DayForecast 5-DayForecast }
  else { dialog -m 5-DayForecast 5-DayForecast }
}
Alias -l GetRad {
  if ($isfile($+(wunderground\,$2))) { .remove $+(wunderground/,$2) }
  set %GetRad.Site $gettok($remove($1,http://),1,47)
  set %GetRad.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  set %GetRad.PicName $2
  if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
  sockclose GetRad
  sockopen GetRad %GetRad.site 80
}
On *:sockopen:GetRad:{
  sockwrite -nt $sockname GET %GetRad.url HTTP/1.0
  sockwrite $sockname Host: %GetRad.site $+ $crlf $+ $crlf
}
On *:sockread:GetRad:{
  if (!$sock($sockname).mark) {
    var %GetRad.var | sockread %GetRad.var
    if (%GetRad.var == $null) { sockmark $sockname 1 }
  }
  else {
    sockread &pict 
    bwrite $qt($+($mircdir,wunderground\,%GetRad.picname)) -1 -1 &pict
  }
}  
On *:sockclose:GetRad:{
  unset %GetRad.*
}
;alias by Gummo
alias -l between { 
  noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) 
  return $regml($4) 
}
alias -l httpstrip {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9),$chr(13))
  return %x
}
alias -l colorz {
  var %string = $1-, %count = $gettok($1-,0,32), %counter = 1, %return
  var %c1 04 
  var %c2 04
  while (%counter <= %count) {
    if ($left($gettok(%string,%counter,32),1) isalpha) {
      %return = %return $+(,%c1,$left($gettok(%string,%counter,32),1),,%c2,$right($gettok(%string,%counter,32),$calc($len($gettok(%string,%counter,32)) - 1)),)
    }
    else { %return = %return $gettok(%string,%counter,32) }
    inc %counter
  }
  $iif($isid,return,say) %return
}
alias -l FtoC { $iif($isid,return,echo -a) $+($round($calc((5 / 9) * ($1 - 32)),0),�,C) }
alias -l CtoF { $iif($isid,return,echo -a) $+($round($calc(((9 / 5) * $1) + 32),0),�,F) }
menu * {
  Wunderground
  .Weather Dialogs:CurrentConditions
  .$iif($group(#Wunderground.Trigger) == On,$style(1)) Wunderground Trigger
  ..$iif($group(#Wunderground.Trigger) == On,$style(2)) On: .enable #Wunderground.Trigger
  ..$iif($group(#Wunderground.Trigger) == Off,$style(2)) Off: .disable #Wunderground.Trigger
  -
}


Related Files

by Bry`
by Gummo

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand