mIRC Twitter stats Dialog

By GrimReaper on Jun 07, 2010

Screenshots

I know there are a few on here already. But I wanted to make a Twitter stats dialog that echo's and message's the channel you are looking in.

So I did.

It's a Menubar, Channel, Query, Status, Nicklist menu to open the dialog, Then it will save your Twitter name in a var and place it in the search box if there is one saved already, else it will ask you for the Default one.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mIRC Twitter Stats Dialog        ;;
;; Made by GrimReaper               ;;
;; irc.SPUNet.org #SPUNet           ;;
;; irc.geekshed.net #hell           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

menu * {
  mIRC Twitter Stats:twitterstats
}

dialog twitter_stats {
  title "mIRC Twitter Stats by GrimReaper"
  size -1 -1 130 107
  option dbu
  edit "", 4, 4 4 85 10
  button "Search", 5, 90 3 37 12
  button "Msg Channel", 6, 4 90 37 12
  button "Echo Active", 7, 46 90 37 12
  button "Clear All", 8, 89 90 37 12
  text "Total Followers:", 9, 4 24 38 8
  text "Total Following:", 10, 4 42 38 8
  text "Total Lists:", 11, 4 58 26 8
  text "Total Updates:", 12, 4 74 36 8
  edit "", 13, 45 23 82 10, read
  edit "", 14, 45 41 82 10, read
  edit "", 15, 45 57 82 10, read
  edit "", 16, 45 73 82 10, read
  menu "File", 1
  item "Clear All", 2, 1
  item "Exit", 3, 1
}

on *:DIALOG:twitter_stats:init:*: {
  if (!%TwitSearchName) {
    set %TwitSearchName $$?="Please enter your Twitter name:"
    did -r $dname 4
    did -a $dname 4 %TwitSearchName
  }
  else {
    did -r $dname 4
    did -a $dname 4 %TwitSearchName
  }
}

on *:DIALOG:twitter_stats:sclick:5,6,7,8: {
  if ($did == 5) {
    did -r $dname 13,14,15,16
    TwitSearchStats $did($dname,4).text
  }
  if ($did == 6) {
    msg $active Twitter stats for $did($dname,4).text $+ :
    msg $active Total followers: $did($dname,13).text
    msg $active Total following: $did($dname,14).text
    msg $active Total lists: $did($dname,15).text
    msg $active Total updates: $did($dname,16).text
  }
  if ($did == 7) {
    echo -at Twitter stats for $did($dname,4).text $+ :
    echo -at Total followers: $did($dname,13).text
    echo -at Total following: $did($dname,14).text
    echo -at Total lists: $did($dname,15).text
    echo -at Total updates: $did($dname,16).text
  }
  if ($did == 8) {
    did -r $dname 13,14,15,16
  }
}

on *:DIALOG:twitter_stats:menu:2,3: {
  if ($did == 2) {
    did -r $dname 5,6,7,8
  }
  if ($did == 3) {
    dialog -x twitter_stats twitter_stats
  }
}

alias -l TwitSearchStats {
  if ($sock(TwitSearchStats)) { sockclose $sockname | did -a twitter_stats 16 Error, Please try again. }
  else {
    sockopen TwitSearchStats twitter.com 80
  }
}

on *:SOCKOPEN:TwitSearchStats: {
  if ($sockerr) { did -a twitter_stats 16 Error, Please try again. }
  else {
    sockwrite -nt $sockname GET / $+ $did(twitter_stats,4).text HTTP/1.0
    sockwrite -nt $sockname Host: twitter.com
    sockwrite -n $sockname $crlf
  }
}

on *:SOCKREAD:TwitSearchStats: {
  sockread %TwitStats
  if (<span id="following_count" class="stats_count numeric"> isin %TwitStats) {
    did -a twitter_stats 14 $htmlfree(%TwitStats)
  }
  elseif (<span id="follower_count" class="stats_count numeric"> isin %TwitStats) {
    did -a twitter_stats 13 $htmlfree(%TwitStats)
  }
  elseif (<span id="lists_count" class="stats_count numeric"> isin %TwitStats) {
    did -a twitter_stats 15 $htmlfree(%TwitStats)
  }
  elseif (<span id="update_count" class="stat_count"> isin %TwitStats) {
    did -a twitter_stats 16 $remove($htmlfree(%TwitStats),Tweets)
  }
}

alias -l twitterstats {
  if (!$dialog(twitter_stats)) { dialog -m twitter_stats twitter_stats }
  else { dialog -v twitter_stats twitter_stats }
}

alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) | return %x }

Comments

Sign in to comment.
WorldDMT   -  Jun 08, 2010

hi
u can do did -ra $dname ID %var
for the init if !%TwitSearchName it's ok but about the rest is useless u can put the variable %TwitSearchName in dialog like this

edit %TwitSearchName, 4, 4 4 85 10

on *:DIALOG:twitter_stats:init:*:{
  if !%TwitSearchName {
    set %TwitSearchName $$?="Please enter your Twitter name:"
    did -ra $dname 4 $!
  }
}

about $did($dname,4).text u can remove the ".text" and $dname

so u can use only $did(4)

dialog -x twitter_stats twitter_stats
th second "twitter_stats" is useless u can remove it
dialog -x twitter_stats can close the dialog

about your alias twitterstats u can do this

alias -l twitterstats dialog $iif(!$dialog(twitter_stats),-v,-m twitter_stats) twitter_stats

finaly about did -a twitter_stats 16 Error, Please try again. u have to add "r" so

did -ra twitter_stats 16 Error, Please try again.

 Respond  
AnaBotNowYourGone   -  Jun 07, 2010

I like it. ^^

 Respond  
Jonesy44   -  Jun 07, 2010

Nice one ;D

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.