daily pastebin goal
1%
SHARE
TWEET

Wunderground weather + 5 day forecast for mIRC

Ford May 14th, 2012 185 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Wunderground Weather Script by Ford_Lawnmower irc://irc.geekshed.net #Script-Help
  2. dialog CurrentConditions {
  3.   title "Current Conditions"
  4.   size -1 -1 184 136
  5.   option dbu
  6.   text "", 1, 0 1 193 8
  7.   icon 2, 8 16 23 23
  8.   text "", 3, 40 24 41 16, center
  9.   text "Humidity:", 4, 8 48 33 8
  10.   text "Dew Point:", 5, 8 56 33 8
  11.   text "Wind:", 6, 8 64 33 8
  12.   text "Wind Gust:", 7, 8 72 33 8
  13.   text "Pressure:", 8, 8 80 33 8
  14.   text "Heat Index:", 9, 8 88 33 8
  15.   text "Visibility:", 10, 8 96 33 8
  16.   text "UV:", 11, 8 104 33 8
  17.   text "Clouds:", 12, 8 112 33 8
  18.   text "Elevation", 13, 8 120 33 8
  19.   text "", 14, 40 48 49 8
  20.   text "", 15, 40 56 49 8
  21.   text "", 16, 40 64 49 8
  22.   text "", 17, 40 72 49 8
  23.   text "", 18, 40 80 49 8
  24.   text "", 19, 40 88 49 8
  25.   text "", 20, 40 96 49 8
  26.   text "", 21, 40 104 49 8
  27.   text "", 22, 40 112 109 8
  28.   text "", 23, 40 120 49 8
  29.   icon 24, 104 16 63 63
  30.   button "5-Day Forecast", 25, 96 123 41 12, disable
  31.   button "Close", 26, 144 123 37 12, cancel
  32.   text "Enter City State or Zip Code", 27, 96 88 81 8, center
  33.   edit "", 28, 96 96 82 10, autohs
  34.   button "Search", 29, 152 107 29 12
  35.   text "", 30, 8 128 81 8
  36. }
  37. On *:Dialog:CurrentConditions:init:*: { Wunderground Cincinnati Ohio }
  38. On *:Dialog:CurrentConditions:Close:*: {
  39.   if (!$dialog(5-DayForecast)) { hfree WundergroundDialog }
  40. }
  41. On *:Dialog:CurrentConditions:Sclick:25: {
  42.   if ($dialog(5-DayForecast)) {
  43.     did -a 5-DayForecast 1 $hget(WundergroundDialog,location)
  44.     var %5-days = $gettok($hget(WundergroundDialog,days),0,32)
  45.     while (%5-days) {
  46.       did -a 5-DayForecast $calc(%5-days + 1) $gettok($hget(WundergroundDialog,days),%5-days,32)
  47.       did -g 5-DayForecast $calc(%5-days + 6) $+(Wunderground\,$nopath($hget(WundergroundDialog,$+(day,%5-days,pic))))
  48.       did -a 5-DayForecast $calc(%5-days + 11) $+($hget(WundergroundDialog,$+(day,%5-days,high)),|,$hget(WundergroundDialog,$+(day,%5-days,low)))
  49.       did -a 5-DayForecast $calc(%5-days + 16) $hget(WundergroundDialog,$+(day,%5-days,condition))        
  50.       dec %5-days
  51.     }
  52.   }
  53.   else { 5-Day }
  54. }
  55. On *:Dialog:CurrentConditions:Sclick:29: {
  56.   if ($did(CurrentConditions,28).text) { Wunderground $did(CurrentConditions,28).text }
  57.   else { did -a CurrentConditions 30 No search Item!! | .timer 1 3 did -a CurrentConditions 30 }
  58. }
  59. dialog 5-DayForecast {
  60.   title "5-Day Forecast"
  61.   size -1 -1 208 64
  62.   option dbu
  63.   text "", 1, 0 0 209 8, center
  64.   text "", 2, 4 8 41 8, center
  65.   text "", 3, 44 8 41 8, center
  66.   text "", 4, 84 8 41 8, center
  67.   text "", 5, 124 8 41 8, center
  68.   text "", 6, 164 8 41 8, center
  69.   icon 7, 16 16 15 15
  70.   icon 8, 56 16 15 15
  71.   icon 9, 96 16 15 15
  72.   icon 10, 136 16 15 15
  73.   icon 11, 176 16 15 15
  74.   text "", 12, 4 32 41 8, center
  75.   text "", 13, 44 32 41 8, center
  76.   text "", 14, 84 32 41 8, center
  77.   text "", 15, 124 32 41 8, center
  78.   text "", 16, 164 32 41 8, center
  79.   text "", 17, 4 40 41 24, center
  80.   text "", 18, 44 40 41 24, center
  81.   text "", 19, 84 40 41 24, center
  82.   text "", 20, 124 40 41 24, center
  83.   text "", 21, 164 40 41 24, center
  84. }
  85. On *:Dialog:5-DayForecast:Close:*: {
  86.   if (!$dialog(CurrentConditions)) { hfree WundergroundDialog }
  87. }
  88. On *:Dialog:5-DayForecast:init:*: {
  89.   did -a 5-DayForecast 1 $hget(WundergroundDialog,location)
  90.   var %5-days = $gettok($hget(WundergroundDialog,days),0,32)
  91.   while (%5-days) {
  92.     did -a 5-DayForecast $calc(%5-days + 1) $gettok($hget(WundergroundDialog,days),%5-days,32)
  93.     did -g 5-DayForecast $calc(%5-days + 6) $+(Wunderground\,$nopath($hget(WundergroundDialog,$+(day,%5-days,pic))))
  94.     did -a 5-DayForecast $calc(%5-days + 11) $+($hget(WundergroundDialog,$+(day,%5-days,high)),|,$hget(WundergroundDialog,$+(day,%5-days,low)))
  95.     did -a 5-DayForecast $calc(%5-days + 16) $hget(WundergroundDialog,$+(day,%5-days,condition))        
  96.     dec %5-days
  97.   }
  98. }
  99. alias -l Wunderground.timeout {
  100.   if (%Wunder.chan != dialog) { .msg %Wunder.chan Nothing Found... :( | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
  101.   else { did -a CurrentConditions 30 Nothing Found!! | .timer 1 3 did -a CurrentConditions 30 }
  102.   Wunderground.clear
  103. }
  104. alias -l Wunderground.clear {
  105.   sockclose %Wunder.name
  106.   unset %getpic.*
  107.   unset %Wunder*
  108.   .timer-Wunderground off
  109.   halt
  110. }
  111. alias Wunderground {
  112.   .enable #5day
  113.   set %Wunder.nick $me
  114.   set %Wunder.chan dialog
  115.   set %Wunder.name $+(Wunderground,%Wunder.chan)
  116.   if ($hget(%Wunder.name)) { hfree %Wunder.name }
  117.   if ($dialog(CurrentConditions)) { did -b CurrentConditions 25 }
  118.   hmake %Wunder.name 5
  119.   sockclose $+(Wunderground,%Wunder.chan)
  120.   set %Wunderurl $+(/cgi-bin/findweather/getForecast?query=,$replace($1-,$chr(32),$+(%,20)),&wuSelect=WEATHER)
  121.   set %Wundersite classic.wunderground.com
  122.   sockopen %Wunder.name %Wundersite 80
  123.   .timer-Wunderground 1 10 Wunderground.timeout
  124. }
  125. #Wunderground.trigger on
  126. on $*:TEXT:/^!(Forecast|Weather)+/Si:# {
  127.   if (!$timer(wunderground)) {
  128.     .timerwunderground 1 5 noop
  129.     if (%Wunder.inuse == 1) { .notice $nick Sorry, But Somebody else is already looking up their Weather. | halt }
  130.     $iif($regml(1) == forecast,.enable,.disable) #5day
  131.     set %Wunder.inuse 1
  132.     set %Wunder.nick $nick
  133.     set %Wunder.chan $chan
  134.     set %Wunder.name $+(Wunderground,%Wunder.chan)
  135.     if (!$hget(%Wunder.name)) { hmake %Wunder.name 5 }
  136.     sockclose %Wunder.name
  137.     set %Wunderurl $+(/cgi-bin/findweather/getForecast?query=,$replace($2-,$chr(32),$+(%,20)),&wuSelect=WEATHER)
  138.     set %Wundersite classic.wunderground.com
  139.     sockopen $+(Wunderground,$chan) %Wundersite 80
  140.     .msg $chan Weather Search in Progress. Please Wait.....
  141.     .timer-Wunderground 1 10 Wunderground.timeout
  142.   }
  143. }
  144. #Wunderground.trigger end
  145. on *:sockopen:Wunderground*: {
  146.   sockwrite -n $sockname GET %Wunderurl HTTP/1.1
  147.   sockwrite -n $sockname Host: %Wundersite $+ $CRLF $+ $CRLF
  148. }
  149. on *:sockread:Wunderground*: {
  150.   if ($sockerr > 0) { echo -a >Socket Error< |  Wunderground.clear }
  151.   else {
  152.     var %Wundervar |  sockread %Wundervar
  153.     if (Scroll down to view a list of all all cities isin %Wundervar) {
  154.       if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Country match. Be more Specific. | .timer 1 3 did -a CurrentConditions 30 }
  155.       else { .msg %Wunder.chan You searched for a Country. Be more specific. | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
  156.       Wunderground.clear
  157.     }
  158.     if (Click on a column heading to sort this information isin %Wundervar) {
  159.       if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Be more Specific. | .timer 1 3 did -a CurrentConditions 30 }
  160.       else { .msg %Wunder.chan Too many results! Be more specific. | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
  161.       Wunderground.clear
  162.     }
  163.     if (There has been an error isin %Wundervar) {
  164.       if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) { did -a CurrentConditions 30 Location Doesn't exist | .timer 1 3 did -a CurrentConditions 30 }
  165.       else { .msg %Wunder.chan Location Doesn't exist!! | if ($hget(%Wunder.name)) { hfree %Wunder.name } }
  166.       Wunderground.clear
  167.     }
  168.     if (<div id="curcondbox"> isin %Wundervar) { set %Wunder.Box On }
  169.     if (5-Day Forecast isin %Wundervar) && ($dialog(CurrentConditions)) && (%Wunder.Chan == dialog) {
  170.       hadd %Wunder.name 5-Day On
  171.       did -e CurrentConditions 25
  172.     }
  173.     if ($between(%Wundervar,<img src="," height="140",1)) {
  174.       if (jpg isin $right($between(%Wundervar,<img src="," height="140",1),3)) {
  175.         hadd %Wunder.name radarlink $between(%Wundervar,<img src="," height="140",1)
  176.         getrad $hget(%wunder.name,radarlink) $nopath($hget(%wunder.name,radarlink))
  177.         if ($hget(%Wunder.name,radarlink)) && (%wunder.chan == dialog) {
  178.           .timer 1 5 did -g Currentconditions 24 $+(Wunderground\,$nopath($hget(%Wunder.name,radarlink)))
  179.         }
  180.       }
  181.       else {
  182.         hadd %Wunder.name radarlink  temppic.gif
  183.         getrad $between(%Wundervar,<img src="," height="140",1) temppic.gif
  184.         if (%wunder.chan == dialog) {
  185.           if ($hget(%Wunder.name,radarlink)) { .timer 1 5 did -g Currentconditions 24 $+(Wunderground\,temppic.gif) }
  186.         }  
  187.       }
  188.     }
  189.     if (%Wunder.Box == On) {
  190.       if (Humidity: isin %Wundervar) { set %Wunder.Humidity On }
  191.       if (Dew Point: isin %Wundervar) { set %Wunder.dewpoint On }
  192.       if (Wind: isin %Wundervar) { set %Wunder.wind On }
  193.       if (Wind Gust: isin %Wundervar) { set %Wunder.windgust On }
  194.       if (Pressure: isin %Wundervar) { set %Wunder.pressure On }
  195.       if (Heat Index: isin %Wundervar) { set %Wunder.heatindex On }
  196.       if (Visibility: isin %Wundervar) { set %Wunder.visibility On }
  197.       if (UV: isin %Wundervar) { set %Wunder.UV On }
  198.       if (Clouds: isin %Wundervar) { set %Wunder.clouds On }
  199.       if (Elevation: isin %Wundervar) { set %Wunder.elevation On }
  200.       if ($between(%Wundervar,<div class="subG b">,</div>,1)) {
  201.         hadd %Wunder.name location $between(%Wundervar,<div class="subG b">,</div>,1)
  202.       }
  203.       if (<span class="nobr"><span class="b"> isin %Wundervar) &&  (!$hget(%Wunder.name,temperature)) {
  204.         hadd %Wunder.name temperature $deg($httpstrip(%Wundervar))
  205.       }
  206.       if ($between(%Wundervar,<td class="vaM taC"><img src="," width="42",1)) {
  207.         hadd %Wunder.name ConditionLink $between(%Wundervar,<td class="vaM taC"><img src="," width="42",1)
  208.         getpik $hget(%Wunder.name,Conditionlink) $nopath($hget(%Wunder.name,Conditionlink))
  209.       }
  210.       if ($between(%Wundervar,<div class="b" style="font-size: 14px;">,</div>,1)) {
  211.         hadd %Wunder.name condition $between(%Wunder,<div class="b" style="font-size: 14px;">,</div>,1)
  212.       }
  213.       if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.elevation) {
  214.         hadd %Wunder.name elevation $httpstrip(%Wundervar)
  215.         unset %Wunder.elevation
  216.         unset %Wunder.Box
  217.       }      
  218.       if ($between(%Wundervar,<b>,</b>,1)) && (%Wunder.clouds) {
  219.         hadd %Wunder.name clouds $between(%Wundervar,<b>,</b>,1)
  220.         unset %Wunder.clouds
  221.       }
  222.       if ($between(%Wundervar,<td class="b">,</td>,1)) && (%Wunder.UV) {
  223.         hadd %Wunder.name UV $httpstrip(%Wundervar)
  224.         unset %Wunder.UV
  225.       }
  226.       if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.visibility) {
  227.         hadd %Wunder.name visibility $httpstrip(%Wundervar)
  228.         unset %Wunder.visibility
  229.       }      
  230.       if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.heatindex) {
  231.         hadd %Wunder.name heatindex $deg($httpstrip(%Wundervar))
  232.         unset %Wunder.heatindex
  233.       }      
  234.       if ($between(%Wundervar,<b>,</b>,1)) && (%Wunder.pressure) {
  235.         hadd %Wunder.name pressure $httpstrip(%Wundervar)
  236.         unset %Wunder.pressure
  237.       }
  238.       if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.windgust) {
  239.         hadd %Wunder.name windgust $httpstrip(%Wundervar)
  240.         unset %Wunder.windgust
  241.       }      
  242.       if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.wind) {
  243.         hadd %Wunder.name wind $httpstrip(%Wundervar)
  244.         unset %Wunder.wind
  245.       }      
  246.       if (<span class="nobr"><span class="b"> isin %Wundervar) && (%Wunder.dewpoint) {
  247.         hadd %Wunder.name dewpoint $deg($httpstrip(%Wundervar))
  248.         unset %Wunder.dewpoint
  249.       }
  250.       if ($between(%Wundervar,<td class="full b"><span class="pwsrt",</nobr></span></td>,1)) && (%Wunder.humidity) {
  251.         hadd %Wunder.name humidity $httpstrip(%Wundervar)
  252.         unset %Wunder.humidity
  253.       }
  254.     }
  255.     if (<tr class="wHover noBorder"> isin %Wundervar) { set %Wunder.5-day On | unset %Wunder.Box }
  256.     if (<td class="taC" style="width: isin %Wundervar) && (</td> isin %Wundervar) {
  257.       hadd %Wunder.name days $hget(%Wunder.name,days) $httpstrip(%Wundervar)
  258.     }
  259.     if (<td>Enable</td> isin %Wundervar) {
  260.       if (%Wunder.chan == dialog) && ($dialog(CurrentConditions)) {
  261.         if ($hget(%Wunder.name,location)) { did -a Currentconditions 1 $hget(%Wunder.name,location) }
  262.         if ($hget(%Wunder.name,temperature)) { did -a Currentconditions 3 $hget(%Wunder.name,temperature)  }
  263.         if ($hget(%Wunder.name,humidity)) { did -a Currentconditions 14 $hget(%Wunder.name,humidity) }
  264.         if ($hget(%Wunder.name,dewpoint)) { did -a Currentconditions 15 $hget(%Wunder.name,dewpoint) }
  265.         if ($hget(%Wunder.name,wind)) { did -a Currentconditions 16 $hget(%Wunder.name,wind) }
  266.         if ($hget(%Wunder.name,windgust)) { did -a Currentconditions 17 $hget(%Wunder.name,windgust) }
  267.         if ($hget(%Wunder.name,pressure)) { did -a Currentconditions 18 $hget(%Wunder.name,pressure) }
  268.         if ($hget(%Wunder.name,heatindex)) { did -a Currentconditions 19 $hget(%Wunder.name,heatindex) }
  269.         if ($hget(%Wunder.name,visibility)) { did -a Currentconditions 20 $hget(%Wunder.name,visibility) }
  270.         if ($hget(%Wunder.name,UV)) { did -a Currentconditions 21 $hget(%Wunder.name,UV) }
  271.         if ($hget(%Wunder.name,clouds)) { did -a Currentconditions 22 $hget(%Wunder.name,clouds) }
  272.         if ($hget(%Wunder.name,elevation)) { did -a Currentconditions 23 $hget(%Wunder.name,elevation) }
  273.         if ($hget(%Wunder.name,conditionlink)) { .timer 1 5 did -g Currentconditions 2 $+(Wunderground\,$nopath($hget(%Wunder.name,conditionlink))) }
  274.       }
  275.       else {
  276.         .msg %wunder.chan $colorz(Weather for $hget(%Wunder.name,location)  Temperature: $hget(%Wunder.name,temperature)  Humidity: $hget(%Wunder.name,humidity) $&
  277.           Dew Point: $hget(%Wunder.name,dewpoint)  Wind: $hget(%Wunder.name,wind)  Pressure: $hget(%Wunder.name,pressure)  Heat Index: $&
  278.           $hget(%Wunder.name,heatindex)  Visibility: $hget(%Wunder.name,visibility)  Clouds: $hget(%Wunder.name,clouds)) $+ .
  279.       }
  280.     }
  281.     if (<td class="full">Forecast for isin %Wundervar) {
  282.       if (%Wunder.chan != dialog) { hfree %Wunder.name }
  283.       Wunderground.clear
  284.     }
  285.     if ($group(#5day) == on) {    
  286.       if (%Wunder.5-day == On) {
  287.         if (<tr class="wHover noBorder"> isin %Wundervar) && ($hget(%Wunder.name,day5pic)) {
  288.           if (%Wunder.chan == dialog) && $dialog(CurrentConditions) {
  289.             WunderGround.Clear
  290.           }
  291.           else {
  292.             .msg %wunder.chan $colorz(5-Day Forecast - $gettok($hget(%Wunder.name,days),1,32)  $hget(%Wunder.name,day1high)  $hget(%Wunder.name,day1low) $&
  293.               $hget(%Wunder.name,day1condition) - $gettok($hget(%Wunder.name,days),2,32)  $hget(%Wunder.name,day2high)  $hget(%Wunder.name,day2low) $&
  294.               $hget(%Wunder.name,day2condition) - $gettok($hget(%Wunder.name,days),3,32)  $hget(%Wunder.name,day3high)  $hget(%Wunder.name,day3low) $&
  295.               $hget(%Wunder.name,day3condition) .)
  296.             .msg %wunder.chan $colorz(5-Day Forecast - $gettok($hget(%Wunder.name,days),4,32)  $hget(%Wunder.name,day4high)  $hget(%Wunder.name,day4low) $&
  297.               $hget(%Wunder.name,day4condition) - $gettok($hget(%Wunder.name,days),5,32)  $hget(%Wunder.name,day5high)  $hget(%Wunder.name,day5low) $&
  298.               $hget(%Wunder.name,day5condition) .)
  299.             hfree %Wunder.name
  300.           }
  301.           wunderground.clear
  302.         }
  303.         if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day5pic)) && ($hget(%Wunder.name,day4pic)) {
  304.           hadd %Wunder.name day5pic $between(%Wundervar,<div><img src="," alt=",1)
  305.           hadd %Wunder.name day5condition $between(%Wundervar,alt="," width="42",1)
  306.           .timer 1 5 getpic $hget(%Wunder.name,day5pic) $nopath($hget(%Wunder.name,day5pic))
  307.         }
  308.         if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day5high)) && ($hget(%Wunder.name,day4high)) {
  309.           hadd %Wunder.name day5high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
  310.         }
  311.         if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day5low)) && ($hget(%Wunder.name,day4low)) {
  312.           hadd %Wunder.name day5low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
  313.         }
  314.         if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day4pic)) && ($hget(%Wunder.name,day3pic)) {
  315.           hadd %Wunder.name day4pic $between(%Wundervar,<div><img src="," alt=",1)
  316.           hadd %Wunder.name day4condition $between(%Wundervar,alt="," width="42",1)
  317.           .timer 1 4 getpic $hget(%Wunder.name,day4pic) $nopath($hget(%Wunder.name,day4pic))
  318.         }
  319.         if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day4high)) && ($hget(%Wunder.name,day3high)) {
  320.           hadd %Wunder.name day4high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
  321.         }
  322.         if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day4low)) && ($hget(%Wunder.name,day3low)) {
  323.           hadd %Wunder.name day4low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
  324.         }
  325.         if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day3pic)) && ($hget(%Wunder.name,day2pic)) {
  326.           hadd %Wunder.name day3pic $between(%Wundervar,<div><img src="," alt=",1)
  327.           hadd %Wunder.name day3condition $between(%Wundervar,alt="," width="42",1)
  328.           .timer 1 3 getpic $hget(%Wunder.name,day3pic) $nopath($hget(%Wunder.name,day3pic))
  329.         }
  330.         if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day3high)) && ($hget(%Wunder.name,day2high)) {
  331.           hadd %Wunder.name day3high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
  332.         }
  333.         if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day3low)) && ($hget(%Wunder.name,day2low)) {
  334.           hadd %Wunder.name day3low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
  335.         }
  336.         if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day2pic)) && ($hget(%Wunder.name,day1pic)) {
  337.           hadd %Wunder.name day2pic $between(%Wundervar,<div><img src="," alt=",1)
  338.           hadd %Wunder.name day2condition $between(%Wundervar,alt="," width="42",1)
  339.           .timer 1 2 getpic $hget(%Wunder.name,day2pic) $nopath($hget(%Wunder.name,day2pic))
  340.         }
  341.         if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day2high)) && ($hget(%Wunder.name,day1high)) {
  342.           hadd %Wunder.name day2high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1))
  343.         }
  344.         if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day2low)) && ($hget(%Wunder.name,day1low)) {
  345.           hadd %Wunder.name day2low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
  346.         }
  347.         if ($between(%Wundervar,<div><img src="," alt=",1)) && (!$hget(%Wunder.name,day1pic)) {
  348.           hadd %Wunder.name day1pic $between(%Wundervar,<div><img src="," alt=",1)
  349.           hadd %Wunder.name day1condition $between(%Wundervar,alt="," width="42",1)
  350.           .timer 1 1 getpic $hget(%Wunder.name,day1pic) $nopath($hget(%Wunder.name,day1pic))
  351.         }
  352.         if ($between(%Wundervar,<span style="color: #900;">,</span>,1)) && (!$hget(%Wunder.name,day1high)) {
  353.           hadd %Wunder.name day1high $deg($between(%Wundervar,<span style="color: #900;">,</span>,1)   )
  354.         }
  355.         if ($between(%Wundervar,<span style="color: #009;">,</span>,1)) && (!$hget(%Wunder.name,day1low)) {
  356.           hadd %Wunder.name day1low $deg($between(%Wundervar,<span style="color: #009;">,</span>,1))
  357.         }
  358.       }
  359.     }  
  360.   }
  361. }
  362. alias -l deg {
  363.   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)))
  364. }
  365. Alias  -l GetPic {
  366.   if ($sock($+(getpic,$2))) { return }
  367.   if ($isfile($+(wunderground\,$2))) { return }
  368.   set %GetPic.Site $gettok($remove($1,http://),1,47)
  369.   set %GetPic.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  370.   set %GetPic.PicName $2
  371.   if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
  372.   sockopen $+(GetPic,%getpic.picname) %getpic.site 80
  373. }
  374. On *:sockopen:GetPic*:{
  375.   sockwrite -nt $sockname GET %getpic.url HTTP/1.0
  376.   sockwrite $sockname Host: %getpic.site $+ $crlf $+ $crlf
  377. }
  378. On *:sockread:GetPic*:{
  379.   if (!$sock($sockname).mark) {
  380.     var %GetPic.var | sockread %GetPic.var
  381.     if (%GetPic.var == $null) { sockmark $sockname 1 }
  382.   }
  383.   else {
  384.     sockread &picture
  385.     bwrite $qt($+($mircdir,wunderground\,%getpic.picname)) -1 -1 &picture
  386.   }
  387. }
  388. Alias -l GetPik {
  389.   if ($isfile($+(wunderground\,$2))) { return }
  390.   sockclose GetPik
  391.   set %GetPik.Site $gettok($remove($1,http://),1,47)
  392.   set %GetPik.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  393.   set %GetPik.PicName $2
  394.   if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
  395.   sockopen GetPik %GetPik.site 80
  396. }
  397. On *:sockopen:GetPik:{
  398.   sockwrite -nt $sockname GET %GetPik.url HTTP/1.0
  399.   sockwrite $sockname Host: %GetPik.site $+ $crlf $+ $crlf
  400. }
  401. On *:sockread:GetPik:{
  402.   if (!$sock($sockname).mark) {
  403.     var %GetPik.var | sockread %GetPik.var
  404.     if (%GetPik.var == $null) { sockmark $sockname 1 }
  405.   }
  406.   else {
  407.     sockread &pict
  408.     bwrite $qt($+($mircdir,wunderground\,%GetPik.picname)) -1 -1 &pict
  409.   }
  410. }
  411. On *:sockclose:GetPik:{
  412.   unset %GetPik.*
  413. }
  414. alias -l CurrentConditions {
  415.   if ($dialog(CurrentConditions)) { dialog -v CurrentConditions CurrentConditions }
  416.   else { dialog -m CurrentConditions CurrentConditions }
  417. }
  418. alias -l 5-Day {
  419.   if ($dialog(5-DayForecast)) { dialog -v 5-DayForecast 5-DayForecast }
  420.   else { dialog -m 5-DayForecast 5-DayForecast }
  421. }
  422. Alias -l GetRad {
  423.   if ($isfile($+(wunderground\,$2))) { .remove $+(wunderground/,$2) }
  424.   set %GetRad.Site $gettok($remove($1,http://),1,47)
  425.   set %GetRad.URL $remove($1,$gettok($1,1,47),$gettok($1,2,47),//)
  426.   set %GetRad.PicName $2
  427.   if (!$isdir($+($mircdir,wunderground))) { mkdir wunderground }
  428.   sockclose GetRad
  429.   sockopen GetRad %GetRad.site 80
  430. }
  431. On *:sockopen:GetRad:{
  432.   sockwrite -nt $sockname GET %GetRad.url HTTP/1.0
  433.   sockwrite $sockname Host: %GetRad.site $+ $crlf $+ $crlf
  434. }
  435. On *:sockread:GetRad:{
  436.   if (!$sock($sockname).mark) {
  437.     var %GetRad.var | sockread %GetRad.var
  438.     if (%GetRad.var == $null) { sockmark $sockname 1 }
  439.   }
  440.   else {
  441.     sockread &pict
  442.     bwrite $qt($+($mircdir,wunderground\,%GetRad.picname)) -1 -1 &pict
  443.   }
  444. }  
  445. On *:sockclose:GetRad:{
  446.   unset %GetRad.*
  447. }
  448. ;alias by Gummo
  449. alias -l between {
  450.   noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi)
  451.   return $regml($4)
  452. }
  453. alias -l httpstrip {
  454.   var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;,$chr(9),$chr(13))
  455.   return %x
  456. }
  457. alias -l colorz {
  458.   var %string = $1-, %count = $gettok($1-,0,32), %counter = 1, %return
  459.   var %c1 04
  460.   var %c2 04
  461.   while (%counter <= %count) {
  462.     if ($left($gettok(%string,%counter,32),1) isalpha) {
  463.       %return = %return $+(,%c1,$left($gettok(%string,%counter,32),1),,%c2,$right($gettok(%string,%counter,32),$calc($len($gettok(%string,%counter,32)) - 1)),)
  464.     }
  465.     else { %return = %return $gettok(%string,%counter,32) }
  466.     inc %counter
  467.   }
  468.   $iif($isid,return,say) %return
  469. }
  470. alias -l FtoC { $iif($isid,return,echo -a) $+($round($calc((5 / 9) * ($1 - 32)),0),°,C) }
  471. alias -l CtoF { $iif($isid,return,echo -a) $+($round($calc(((9 / 5) * $1) + 32),0),°,F) }
  472. menu * {
  473.   Wunderground
  474.   .Weather Dialogs:CurrentConditions
  475.   .$iif($group(#Wunderground.Trigger) == On,$style(1)) Wunderground Trigger
  476.   ..$iif($group(#Wunderground.Trigger) == On,$style(2)) On: .enable #Wunderground.Trigger
  477.   ..$iif($group(#Wunderground.Trigger) == Off,$style(2)) Off: .disable #Wunderground.Trigger
  478.   -
  479. }
  480. #5day off
  481. #5day end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top