Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Titlebar news ticker

Recommended Posts

  • Administrators
Description: 8 news topics, uses Australian ABC news service. Attaches to the end of existing titlebar (up to 60 chars length). Allows user-defined separators (up to 2 chars)

 

>; basic news ticker - Author: Chimera - Date: 24/10/03 - updated 1/11/03 ; note: Place this script higher than other titlebar scripts in the File -> Order... dialog on 1:START:news justin on 1:EXIT:{ titlebar $remove($gettok($titlebar,1,160),::) | unset %news.* } on 1:UNLOAD:{ sockclose news | titlebar $remove($gettok($titlebar,1,160),::) | .timernews* off | if ($hget(news)) .hfree news | unset %news.* } ; 8 news topics - default is "justin" news ; News website is ABC in Australia, so a lot of items are specific to that region ; Usage - /news [1-8/off/help] [separator(2 chars max)] alias news { if (!$show) { titlebar $iif($titlebar,$gettok($titlebar,1,160)) $+($iif($2 !isin $gettok($titlebar,1,160),$2),$chr(160),$right($3-,$1)) | .timernews -mo 1 50 .news $calc($iif($len($3-) > $calc(-($1)),$1,0) - 1) $2 $iif($len($3-) > $calc(-($1)),$3-,$str($chr(160),50) $asctime(h:nntt) $hget(news,$rand(1,$hget(news,0).item))) } elseif ($1 == off) || ($1 == stop) { sockclose news | titlebar $remove($gettok($titlebar,1,160),::) | .timernews* off | if ($hget(news)) .hfree news | .disable #news | unset %news.* } elseif ($1 == help) || ($1 == ?) var %cdc = $+($readini(" $+ $mircdir $+ mirc.ini",text,commandchar),news), %info = $input(For a news topic enter one of the following: $crlf $crlf Latest - %cdc 1 $crlf Offbeat - %cdc 2 $crlf World - %cdc 3 $crlf Arts - %cdc 4 $crlf Health - %cdc 5 $crlf Media - %cdc 6 $crlf Environment - %cdc 7 $crlf Indigenous - %cdc 8 $crlf $crlf You can also use %cdc [topicname] [separator] $crlf $crlf To stop the ticker use %cdc stop $crlf $crlf •¤ © Oct 2003 Chimera ¤• $crlf ,68,News Ticker) else { var %news.topics = justin offbeat world arts health media environment indigenous if ($hget(news)) .hfree news sockclose news .timernews* off .enable #news sockopen news www.abc.net.au 80 sockmark news $iif($istok(%news.topics,$1,32),$lower($1),$iif($1 isnum 1-8,$gettok(%news.topics,$1,32),justin)) $iif(($2) && ($chr(124) !isin $2),$left($2,2),::) titlebar $iif($titlebar,$left($remove($gettok($titlebar,1,160),::),60)) $+($iif(($2) && ($2 != ::),$iif($left($2,2) !isin $titlebar,$left($2,2)),::),$chr(160),$iif($gettok($sock(news).mark,1,32) != justin,$upper($gettok($sock(news).mark,1,32)))) News $iif($gettok($sock(news).mark,1,32) != justin,loading...,just in...) .timernewsticker -o 0 3600 news $sock(news).mark } } ;Add News submenu to Status and Channel right-click popup menus menu status,channel { News ticker .Latest:news .Offbeat:news 2 .World:news 3 .Arts:news 4 .Health:news 5 .Media:news 6 .Environment:news 7 .Indigenous:news 8 .- .$iif($group(#news) == on,Turn OFF):news off .Help Info:news help } #news off ; Restrict any external calls to titlebar alias to a length of 60 chars while news ticker is running alias titlebar titlebar $iif($chr(160) isin $1-,$1-,$left($1-,60)) ; Request page from website of the given topic on *:sockopen:news:{ sockwrite -n $sockname GET /news/ $+ $gettok($sock(news).mark,1,32) $+ /default.htm HTTP/1.1 sockwrite -n $sockname Host: www.abc.net.au $+ $str($crlf,2) sockmark news 1 $gettok($sock(news).mark,2,32) } ; Fill news hash table with newsitems from webpage on *:sockread:news:{ if ($sockerr > 0) { echo -a $sockerr | return } sockread %news.temp if (firstwallacepara isin %news.temp) { var %n = 1 while ($wildtok(%news.temp,*firstwallacepara*,%n,60)) { var %wm = $ifmatch, %wn = $gettok($sock(news).mark,1,32) if ($calc($len($hget(news,%wn)) + $len(%wm) - 27) > 600) .sockmark news $calc(%wn + 1) $gettok($sock(news).mark,2,32) .hadd -m news %wn $hget(news,%wn) $gettok($sock(news).mark,2,32) $replace($right(%wm,-27),$chr(32),$chr(160)) inc %n } } } ; Start the news ticker on 1:sockclose:news:{ .news -1 $gettok($sock(news).mark,2,32) $str($chr(160),50) $asctime(h:nntt) $hget(news,$rand(1,$gettok($sock(news).mark,1,32))) sockclose news | unset %news.* } #news end 

Link to comment
Share on other sites



×
×
  • Create New...