daily pastebin goal
17%
SHARE
TWEET

moo mIRC script v3.19 by HM2K }Oo. - IRC@HM2K.ORG

a guest Aug 3rd, 2014 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;.oO{ moo script v3.19 by HM2K }Oo. - IRC@HM2K.ORG
  2.  
  3. ;description:
  4. ;no more moo.dll! -- this script uses $com to lookup the WMI functions to return specified system information.
  5. ;moo script was originally created to display your system information via IRC, including: operating system,
  6. ;  uptime, cpu, memory usage, graphics card, resolution, network details and hard drive details.
  7.  
  8. ;install:
  9. ;NOTICE: please unload and remove any old moo scripts, else this script may not work.
  10. ;make sure moo.mrc is in your $mircdir then type: /load -rs moo.mrc
  11.  
  12. ;Please make sure you have the latest windows updates or the latest WMI core (http://goo.gl/nAYpB)
  13. ;Also, please use the latest version of mIRC, ideally mIRC v6.16 or above...
  14.  
  15. ;usage:
  16. ;for moo type: /moo or !moo (if enabled)
  17. ;for uptime only type: /up or !uptime (if enabled)
  18.  
  19. ;history:
  20. ;moo script v3.19       - added better output relaying
  21. ;moo script v3.18       - added find the fastest network interface and find active graphics card
  22. ;moo script v3.17       - added cpu architecture descriptors
  23. ;moo script v3.16       - Added /stat and /statself, and fixed local echoing.
  24. ;moo script v3.15       - Fixed a few bugs + Fixed the repeat checker + Out of beta
  25. ;moo script v3.14       - Change the WMI lookup location of the rammax inline with the ramuse.
  26. ;moo script v3.13       - Changed the ram function to use a more reliable WMI location, added OSArchitecture (osarc) for Vista, fixed CPU load to not return anything if there's no load.
  27. ;moo script v3.12       - Minor tweaks, a few code changes, added /moo echo and a few more functions.
  28. ;moo script v3.11       - Added some new features and made it easier to style the output, added some additional notes
  29. ;moo script v3.1        - Added the long awaited flood protection, simple lookup error checking, more/better functions, quicker script
  30. ;moo script v3.0        - The whole script was changed, no more moo.dll, it now uses WMI however this version MUST be run on mIRC v6.16 or above.
  31. ;[moo] script v2.27     - !moo trigger fix, now turned off by default to stop abuse
  32. ;[moo] script v2.26     - Lots of little changes made up till this version, including getmoo.
  33. ;[moo] script v2.23     - changed some alias' to alias -l, fixed small bugs, added new featuers
  34. ;[moo] script v2.22     - minor bug fixes, bold added etc.
  35. ;[moo] script v2.21     - added a feature to turn the !moo get and !getmoo on or off, and fixed a few bugs.
  36. ;[moo] script v2.2      - name change, completly changed the /moo and !moo system, should work better now, no mistakes.
  37. ;moo script v2.13       - still a few mistakes, changes made, mbm5 isn't functioning correctly...
  38. ;moo script v2.12       - many small changes and fixes made, mbm5 was fixed also.
  39. ;moo script v2.11       - simple bug fixes.
  40. ;moo script v2.1        - minor modifications, final public release.
  41. ;moo script v2.0        - New name, new style, new script, same idea.
  42. ;MooDll Script v1.21    - Many bug fixes, first public release
  43. ;MooDll Script v1.0     - Original private release, very simple, buggy.
  44.  
  45. ;thanks:
  46. ;Mark (from influenced.net) for the original concept and for letting me know that he was not creating a new moo.dll
  47. ;HndlWCare who inspired me to write this for making false claims about the original moo.dll
  48.  
  49. ;support:
  50. ;Help support continued development: Please consider donating (http://tinyurl.com/hm2kpaypal). Thanks!
  51.  
  52. ;--------------------------------------------------------------------------------------------------------
  53. ;SETTINGS - START
  54. ;--------------------------------------------------------------------------------------------------------
  55.  
  56. ;moo banned channels - these are channels you don't want the triggers to function in
  57. alias -l moo.banchans return #php #windows #eztv
  58.  
  59. ;moo style - use this to style the titles of the output
  60. alias -l moos return $+(,$1,:)
  61.  
  62. ;moo prefix - style the prefix
  63. alias -l mooprefix return moo:
  64.  
  65. ;--------------------------------------------------------------------------------------------------------
  66. ;SETTINGS - END
  67. ;--------------------------------------------------------------------------------------------------------
  68.  
  69. ;NOTICE: DO NOT edit below unless you know what you're doing. If you do make any changes, please let me know! :)
  70.  
  71. alias -l moover return moo script v3.19
  72.  
  73. ;usage: /moo <os|up|cpu|gfx|res|ram|hdd|net>
  74. alias moo $iif($isid,return $stat($1),stat $1)
  75. alias stat {
  76.   if ($isid) {
  77.     if (!$mooi(name)) { return lookup error }
  78.     if (!$1) { return $mooprefix $moo(os) $moo(up) $moo(cpu) $moo(gfx) $moo(res) $moo(ram) $moo(hdd) $moo(net) }
  79.     if ($1 == os) { return $moos($1) $mooi(ostitle) - $mooi(ossp) $brak($mooi(osver)) }
  80.     if ($1 == up) { return $moos($1) $duration($mooi(up)) }
  81.     if ($1 == cpu) { return $moos($1) $mooi(cpuname) $brak($mooi(cpuarch)) at $mooi(cpuspeed) $mooi(cpuload) }
  82.     if ($1 == gfx) { return $moos($1) $mooi(gfxmake) $mooi(gfxproc) $mooi(gfxram) }
  83.     if ($1 == res) { return $moos($1) $mooi($1) $mooi(resbit) $mooi(resrate) }
  84.     if ($1 == ram) { var %moo.rammax = $mooi(rammax) | var %moo.ramuse = $mooi(ramuse) | return $moos($1) $+($round($calc(%moo.rammax - %moo.ramuse),0),/,%moo.rammax,MB) $+($chr(40),$round($calc((%moo.rammax - %moo.ramuse) / %moo.rammax * 100),2),%,$chr(41)) $moorambar($round($calc((%moo.rammax - %moo.ramuse) / %moo.rammax * 100),2)) }
  85.     if ($1 == hdd) { return $moos($1) $mooi(hdd) }
  86.     if ($1 == net) { return $moos($1) $iif($mooi(netname),$ifmatch $iif($mooi(netspeed), - $ifmatch, ) $mooi(netin) In $mooi(netout) Out, ) }
  87.     elseif ($mooi($1)) { return $moos($1) $ifmatch }
  88.   }
  89.   var %out $relay($active)
  90.   if (!$1) { %out $moo | return }
  91.   if ($moo($1)) { %out $mooprefix $ifmatch }
  92. }
  93. alias mooecho {
  94.   var %out echo $color(info2) -gat
  95.   if (!$1) { %out $moo | return }
  96.   if ($moo($1)) { %out $mooprefix $ifmatch }
  97. }
  98. alias statself mooecho $1-
  99.  
  100. alias -l relay { ;output relay v0.05 by HM2K
  101.   ;default
  102.   var %out echo $color(info2) -gat
  103.   ;channel command
  104.   var %chanmsg msg
  105.   ;user action
  106.   var %usermsg msg
  107.  
  108.   if ($modespl) {
  109.     if ($1) {
  110.       if (!$gettok($1,2,32)) {
  111.         if ($left($1,1) != $chr(35)) { var %out %chanmsg $1 }
  112.         elseif ($chan($1)) { var %out %chanmsg $1 }
  113.       }
  114.     }
  115.     elseif (($nick) && ($nick != $me)) { var %out %usermsg $nick }
  116.   }
  117.   if ($isid) { return %out }
  118.   %out $1-
  119. }
  120.  
  121. ;info - below are the useful or interesting wmi functions to use with the script
  122. alias mooi {
  123.   if ($1 == name) { return $wmiget(Win32_ComputerSystem).Name }
  124.   if ($1 == ostitle) { return $wmiget(Win32_OperatingSystem).Caption }
  125.   if ($1 == ossp) { return $wmiget(Win32_OperatingSystem).CSDVersion }
  126.   if ($1 == osver) { return $wmiget(Win32_OperatingSystem).Version }
  127.   if ($1 == osinstall) { var %time = $ctime($iif($wmiget(Win32_OperatingSystem).InstallDate,$+($mid($ifmatch,7,2),/,$mid($ifmatch,5,2),/,$mid($ifmatch,1,4)) $+($mid($ifmatch,9,2),:,$mid($ifmatch,11,2),:,$mid($ifmatch,13,2)))) | return $asctime(%time) $brak($duration($calc($ctime - %time)) ago) }
  128.   if ($1 == osarc) { return $wmiget(Win32_OperatingSystem).OSArchitecture }
  129.   if ($1 == up) { return $uptime(system,3) }
  130.   if ($1 == cpuname) { return $wmiget(Win32_Processor).Name }
  131.   if ($1 == cpuspeed) { return $+($wmiget(Win32_Processor).CurrentClockSpeed,MHz) }
  132.   if ($1 == cpuload) { return $iif($wmiget(Win32_Processor).LoadPercentage,$brak($+($ifmatch,% Load)),) }
  133.   if ($1 == cputotal) { return $wmiget(Win32_ComputerSystem).NumberOfProcessors }
  134.   if ($1 == cpuarch) { return $mooarch($wmiget(Win32_Processor).Architecture) }
  135.   if ($1 == gfxmake) { return $wmiget(Win32_VideoController,$moogfx).AdapterCompatibility }
  136.   if ($1 == gfxproc) { return $wmiget(Win32_VideoController,$moogfx).VideoProcessor }
  137.   ;if ($1 == gfxproc) { return $wmiget(CIM_VideoController,$moogfx).Description }
  138.   if ($1 == gfxram) { return $bytes($wmiget(Win32_VideoController,$moogfx).AdapterRam,3).suf }
  139.   if ($1 == res) { return $+($wmiget(Win32_VideoController,$moogfx).currenthorizontalresolution,x,$wmiget(Win32_VideoController).currentverticalresolution) }
  140.   if ($1 == resbit) { return $wmiget(Win32_VideoController,$moogfx).currentbitsperpixel $+ bit }
  141.   if ($1 == resrate) { return $wmiget(Win32_VideoController,$moogfx).currentrefreshrate $+ Hz }
  142.   if ($1 == rammax) { return $round($calc($wmiget(Win32_OperatingSystem).TotalVisibleMemorySize / 1024),1) }
  143.   if ($1 == ramuse) { return $round($calc($wmiget(Win32_OperatingSystem).FreePhysicalMemory / 1024), 1) }
  144.   if ($1 == netname) { return $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,$mooni).Name }
  145.   if ($1 == netspeed) { return $calc($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,$mooni).CurrentBandwidth / 1000000) $+ MB/s }
  146.   if ($1 == netin) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,$mooni).BytesReceivedPersec).suf }
  147.   if ($1 == netout) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,$mooni).BytesSentPersec).suf }
  148.   if ($1 == hdd) { var %i 1 | while (%i <= $disk(0)) { if ($disk(%i).type == fixed) var %var %var $disk(%i).path $+($bytes($disk(%i).free).suf,/,$bytes($disk(%i).size).suf) | inc %i } | return %var }
  149.   if ($1 == sound) { return $wmiget(Win32_SoundDevice).Name }
  150.   if ($1 == mobo) { return $wmiget(Win32_BaseBoard).Manufacturer $wmiget(Win32_BaseBoard).Product }
  151. }
  152.  
  153. ;find active graphics card
  154. alias -l moogfx {
  155.   var %i = 1, %t = $wmiget(Win32_VideoController,-1).Availability
  156.   while (%i < %t) {
  157.     if ($wmiget(Win32_VideoController,%i).Availability == 3) { return %i }
  158.     inc %i
  159.   }
  160. }
  161.  
  162. ;find fastest network interface
  163. alias mooni {
  164.   var %i = 0, %s = 0, %n = 0
  165.   %t = $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,-1).CurrentBandwidth
  166.   while (%i < %t) {
  167.     inc %i
  168.     %ns = $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,%i).CurrentBandwidth
  169.     if (%ns >= %s) {
  170.       %s = %ns
  171.       %n = %i
  172.     }
  173.   }
  174.   return %n
  175. }
  176.  
  177. ;cpu architecture descriptors
  178. alias -l mooarch {
  179.   if ($1 == 0) { return x86 }
  180.   if ($1 == 1) { return MIPS }
  181.   if ($1 == 2) { return Alpha }
  182.   if ($1 == 3) { return PowerPC }
  183.   if ($1 == 6) { return Intel Itanium Processor Family (IPF) }
  184.   if ($1 == 9) { return x64 }
  185. }
  186.  
  187. ;rambar - the famous rambar from the original script with a couple of changes
  188. alias -l moorambar {
  189.   if ($len($1) < 990) {
  190.     var %moo.rb.size = 10
  191.     var %moo.rb.used = $round($calc($1 / 100 * %moo.rb.size),0)
  192.     var %moo.rb.unused = $round($calc(%moo.rb.size - %moo.rb.used),0)
  193.     var %moo.rb.usedstr = $str(|,%moo.rb.used)
  194.     var %moo.rb.unusedstr = $str(-,%moo.rb.unused)
  195.     if ((%moo.rb.usedstr) && (%moo.rb.unusedstr)) return $+([,%moo.rb.usedstr,%moo.rb.unusedstr,])
  196.   }
  197. }
  198.  
  199. ;Get WMI data - this is the most useful function here, this only works if mIRC has the $COM function, its very useful, but a little slow.
  200. alias wmiget {
  201.   var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
  202.   if ($com(%com)) { .comclose %com }
  203.   if ($com(%com2)) { .comclose %com2 }
  204.   if ($com(%com3)) { .comclose %com3 }
  205.   .comopen %com WbemScripting.SWbemLocator
  206.   var %x = $com(%com,ConnectServer,3,dispatch* %com2), %x = $com(%com2,ExecQuery,3,bstr*,select $prop from $1,dispatch* %com3), %x = $comval(%com3,$iif($2,$2,1),$prop)
  207.   if ($com(%com)) { .comclose %com }
  208.   if ($com(%com2)) { .comclose %com2 }
  209.   if ($com(%com3)) { .comclose %com3 }
  210.   return %x
  211. }
  212.  
  213. ;backets - I got fed up of repeating the same thing
  214. alias -l brak return $+($chr(40),$1-,$chr(41))
  215.  
  216. ;uptime script - this is the short uptime script created to return your current update and retain your best uptime
  217. on *:connect: up x
  218. alias up { ;uptime v0.4
  219.   $iif($timer(up) == $null,.timerup 0 60 up x)
  220.   if (($uptime(system,3) >= %up) || (%up == $null)) set %up $uptime(system,3)
  221.   $iif($1 == x,halt,$iif($chan,msg $chan,$iif($active == Status Window,echo,say)) $+(Windows,2000) Uptime: $uptime(system,1) Best: $duration(%up))
  222. }
  223.  
  224. #!uptime on
  225. on *:text:!uptime:#: if (!$istok($moo.banchans,$chan,32)) { up | $repeatcheck(!uptime) }
  226. #!uptime end
  227.  
  228. ;moo triggers - public display, sharing the script and ctcp moo
  229.  
  230. #!moo on
  231. on *:text:!moo*:#: if (!$istok($moo.banchans,$chan,32)) { $relay($chan) $moo($2) | $repeatcheck(!moo) }
  232. #!moo end
  233. #!getmoo on
  234. on *:text:!getmoo:*: {
  235.   if ($chan) { .notice $nick moo: To get $moover type: "/msg $me !getmoo" (set "/dccignore off" first) | $repeatcheck(!getmoo) | halt }
  236.   else { .close -m $nick | .dcc send $nick $script | .notice $nick moo: Once you receive the script issue: "/load -rs $nopath($script) $+ ", and don't forget to do "/dccignore on" | $repeatcheck(!getmoo) | halt }
  237. }
  238. #!getmoo end
  239. #ctcpmoo off
  240. ctcp *:*:*: if (($1 == MOO) || ($1 == VERSION)) { .ctcpreply $nick $1 $moover by HM2K | $repeatcheck(ctcpmoo) }
  241. #ctcpmoo end
  242.  
  243. alias -l repeatcheck { ;v0.12 by HM2K - will disable the appropriate group if its flooded
  244.   var %rep.lim = 3
  245.   var %rep.t.lim = 25
  246.   var %rep.t.expr = 10
  247.   if (%rep.lockusr- [ $+ [ $nick ] ]) { echo $ifmatch | haltdef }
  248.   inc $+(-u,%rep.t.lim,$chr(32),%,rep-,$nick,.,$len($strip($1-)),.,$hash($strip($1-),32)) 1
  249.   if (%rep- [ $+ [ $nick ] $+ . $+ [ $len($strip($1-)) ] $+ . $+ [ $hash($strip($1-),32) ] ] == %rep.lim) {
  250.     ;ignore -u60 $address($nick,5)
  251.     if ($group($chr(35) $+ $1) == on) { .disable $chr(35) $+ $1 | .echo -gat $1 is $group($chr(35) $+ $1) due to a repeat flood from $iif($chan,$nick in $chan,$nick) $+ , to re-enable: /enable $chr(35) $+ $1 }
  252.     .set $+(-u,%rep.t.expr,$chr(32),%,rep.lockusr-,$nick) 1
  253.   }
  254. }
  255.  
  256. ;onload and onunload checks - making sure everything is as it should be
  257. on *:load: { up x | if ($version < 6.16) { echo -a moo: you need mIRC v6.16 or greater to run this script, get the latest version from www.mirc.com/get.html | unload -rs $script | halt } }
  258. on *:unload: { .timerup off | $iif($input(Do you want to remove the best uptime data,y,unset %up),unset %up,) | .echo $colour(info2) -gat $moover was unloaded, to reload type: /load -rs $script }
  259.  
  260. ;the menus - only simple at the moment, however this script is designed to utilise the /moo and !moo triggers
  261. menu channel,query {
  262.   $moover
  263.   .moo all (/moo): moo
  264.   .moo uptime (/up): up
  265.   .-
  266.   .!moo trigger ( $+ $group(#!moo) $+ ):{
  267.     if ($group(#!moo) != on) { .enable #!moo }
  268.     else { .disable #!moo }
  269.     .echo -ga moo: !moo is $group(#!moo)
  270.   }
  271.   .!uptime trigger ( $+ $group(#!uptime) $+ ):{
  272.     if ($group(#!uptime) != on) { .enable #!uptime }
  273.     else { .disable #!uptime }
  274.     .echo -ga moo: !uptime is $group(#!uptime)
  275.   }
  276.   .!getmoo trigger ( $+ $group(#!getmoo) $+ ):{
  277.     if ($group(#!getmoo) != on) { .enable #!getmoo }
  278.     else { .disable #!getmoo }
  279.     .echo -ga moo: !getmoo is $group(#!getmoo)
  280.   }
  281.   .ctcp moo trigger ( $+ $group(#ctcpmoo) $+ ):{
  282.     if ($group(#ctcpmoo) != on) { .enable #ctcpmoo }
  283.     else { .disable #ctcpmoo }
  284.     .echo -ga moo: ctcpmoo is $group(#ctcpmoo)
  285.   }
  286.   .-
  287.   .unload $remove($script,$scriptdir)
  288.   ..are you sure?
  289.   ...yes: { .unload -rs $script }
  290.   ...no: { .echo $colour(info2) -gat $remove($script,$scriptdir) was NOT unloaded. }
  291. }
  292. ;EOF
RAW Paste Data
Top