Scripts Monitor

By Zmodem on Aug 25, 2008

The Scripts Monitor addon is a simple script that will allow you to view all of the addons/scripts you currently have loaded into your mIRC client. Built-in is also a feature to view any of the files, either with the built-in viewer, notepad or an application of your choice. However, these viewers should never replace the standard mIRC script editor window.

Updates (26 August 2008):

  1. Added the new rich edit box feature to the Viewer dialog. Now it will display any script file of any size/lines. YOU MUST HAVE mIRC 6.35 or HIGHER FOR THIS TO WORK. This feature was just added in that version.

Updates (26 August 2008):

  1. Fixed the long file names stopping the viewer from working properly.
  2. Fixed the unload feature not working in some cases.
  3. Added a check to make sure that when you are attempting to unload a script it will know if it's the Script Monitor itself. If it is, it will close all of it's windows before unloading itself; that is, after you verify that you wish to do this, of course.

Image

;ALIASES
alias smonitor ddialog smonitor
alias -l ddialog $iif(!$dialog($1),dialog -m $1 $1)
alias -l check.list var %s = $selmon | did - $+ $iif(%s,e,b) smonitor 3,23,24
alias -l selmon return $iif(!$1,$did(smonitor,19,$did(smonitor,19).sel),$did(smonitor,19).sel)
alias -l do.readme var %f = " $+ $scriptdirreadme.txt $+ " | $iif($isfile(%f),run %f,return $input(ReadMe.txt file not found!,wo,File Not Found))
alias -l smonitor_unload {
  .timerSviewer* off
  .timerSviewer 1 0 return $input(Scripts Monitor Unloaded Successfully! $+ $crlf $+ $crlf $+ Thank you for using!,io,Unload Complete)
  .unload -rs $+(",$nopath($script),")
}
alias -l unload.script {
  var %s = $check.script, %v = $1, %x = $iif(%s == $+(",$script,"),1,0), %d = dialog -x
  if (%s) {
    if ($input($iif(%x,You are attempting to unload the Scripts Monitor addon that you are currently using. Are you sure that you want to do this?,Are you sure that you wish to unload this script?),wy,Confirm Unload)) {
      if (%x) { $iif($dialog(smonitor),%d smonitor) | $iif($dialog(sviewer),%d sviewer) | $iif($dialog(sabout),%d sabout) } 
      .unload -rs %s
      if (!%x) { gather.scripts }
    }
  }
}
alias check.script {
  var %s = $selmon
  if (%s) {
    :begin
    if (Script: isin %s) { %s = $+(",$script($gettok(%s,2-,32)),") }
    else { %s = $did(smonitor,19,$calc($did(smonitor,19).sel - 1)) | goto begin }
    return %s
  }
}
alias -l open.custom {
  var %f = $check.script, %v = $+(",$sfile($mircdir*.exe,Select a custom file to open this script with...,Use),")
  if (%v) {
    if (!$isfile(%v)) { return $input(The application you have attempted to use does not exist. Please try again.,ho,Script View Failure) }
    if (!$isfile(%f)) { gather.scripts | return $input(The mIRC script file you have attempted to view no longer exists. Please try again.,ho,Script View Failure) }
    run %v %f
  }
}
alias -l load.new {
  var %f = $+(",$sfile($mircdir*.mrc,Select new mIRC script to load,Load),")
  if ($isfile(%f)) {
    if (*.mrc" !iswm %f) { $iif(!$input(This file does not end in the traditional '.mrc' mIRC Script file extension. However $+ $chr(44) if you are sure that it is a mIRC Script file you may continue to load it. $+ $crlf $+ $crlf $+ Do you still wish to load this file?,iyk18,Unknown Extension),return) }
    .load -rs %f
    if ($dialog(smonitor)) { gather.scripts }
    return $input(%f $+ $crlf $+ $crlf $+ Script has been loaded successfully!,iok6,Script Loaded)
  }
}
alias -l sview {
  var %s = $check.script, %v = $1
  if (%s) {
    if (%v == d) { ddialog sviewer }
    sload %v %s
  }
}
alias -l ofolder {
  var %s = $selmon, %i = $selmon(1)
  if (%s) {
    if (Location: isin %s) { run $+(",$gettok(%s,2-,32),") | return }
    run $nofile($+(",$script($gettok(%s,2-,32)),"))
  }
}
alias -l squick {
  var %i = 1, %oString, %p = $1, %t = $script(0)
  if (!%i) return No Scripts Are Currently Loaded!
  while (%i <= %t) {
    %oString = %oString $+ $iif(%p,$script(%i),$nopath($script(%i))) $+ $crlf
    inc %i
  }
  return %oString
}
alias -l sload {
  var %v = $1, %s = $2-
  if ($isfile(%s)) {
    if (%v == d) {
      loadbuf -ro sviewer 2 %s
      did -c sviewer 2 1
      did -ra sviewer 1 Script Loaded: %s
      return
    }
    run notepad %s
  }

}
alias -l gather.scripts {
  if ($dialog(smonitor)) {
    var %i = 1, %t = $script(0), %d = smonitor, %f, %a = did -a %d 19
    did -r %d 19
    did -ra %d 18 &Currently Loaded Scripts ( $+ %t $+ )
    while (%i <= %t) {
      %f = $script(%i)
      %a Script: $nopath(%f)
      %a Location: $nofile(%f)
      %a $chr(32)
      inc %i
    }
    check.list
  }
}

;DIALOGS
dialog -l smonitor {
  title "Scripts Monitor"
  size -1 -1 222 126
  option dbu
  menu "&File", 1
  item "Load &New Script...", 2, 1
  menu "&Open", 3, 1
  item "Using Notep&ad", 4, 3
  item "Using &Dialog Viewer", 5, 3
  item break, 6, 3
  item "C&ustom...", 7, 3
  item break, 8, 1
  item "&Exit", 9, 1, cancel
  menu "&View", 10
  item "Re&fresh", 13, 10
  menu "&Help", 14
  item "Read&Me...", 15, 14
  item break, 16, 14
  item "&About...", 17, 14
  box "", 18, 3 24 216 99
  list 19, 7 32 207 87, size hsbar vsbar
  button "", 20, -4 0 230 21, disable
  button "Vie&w...", 21, 3 3 30 14, flat
  button "&Refresh", 22, 37 3 36 14, flat
  button "&Open Folder", 23, 77 3 36 14, flat
  button "&Unload Script", 24, 125 3 39 14, flat
  button "&Close", 25, 180 3 39 14, flat ok
}
;;EVENTS FOR 'smonitor' DIALOG
ON *:DIALOG:smonitor:*:*: {
  var %d = $dname, %e = $devent, %i = $did
  if (%e == init) { gather.scripts }
  if (%e == menu) {
    if (%i == 2) { load.new }
    if (%i == 4) { sview n }
    if (%i == 5) { sview d }
    if (%i == 7) { open.custom }
    if (%i == 13) { gather.scripts }
    if (%i == 15) { do.readme }
    if (%i == 17) { ddialog sabout }
  }
  if (%e == sclick) {
    if (%i == 19) { check.list }
    if (%i == 21) { sview d }
    if (%i == 22) { gather.scripts }
    if (%i == 23) { ofolder }
    if (%i == 24) { unload.script }
  }
  if ((%e == dclick) && (%i == 19)) { sview d }
}

dialog -l sviewer {
  title "Script Viewer"
  size -1 -1 315 213
  option dbu
  box "Script Loaded:", 1, 3 3 309 186
  edit "", 2, 6 12 303 174, read multi return hsbar vsbar rich
  button "View With &Notepad", 3, 90 193 54 15, ok
  button "&Close", 4, 164 193 54 15, cancel
}
;;EVENTS FOR 'sviewier' DIALOG
ON *:DIALOG:sviewer:sclick:3:sview n $gettok($did(1),2-,58)

dialog -l sabout {
  title "About Scripts Monitor"
  size -1 -1 138 78
  option dbu
  icon 1, 5 9 40 40
  text "Addon:", 2, 52 16 30 9
  text "Scripts Monitor v1.00", 3, 84 16 51 9
  text "Created by:", 4, 52 33 30 9
  text "Zmodem", 5, 84 33 51 9
  box "", 6, -4 53 145 4
  link "http://www.hawkee.com/", 7, 6 63 63 9
  button "&Close", 8, 102 61 30 12, cancel
  text "Icon Not Found!", 9, 5 25 44 9
}
;;EVENTS FOR 'sabout' DIALOG
on *:DIALOG:sabout:init:0:var %f = " $+ $scriptdirsmonitor.png $+ " | if ($exists(%f)) { did -h sabout 9 | did -g sabout 1 %f | return } | did -h sabout 1
on *:DIALOG:sabout:sclick:7:run http://www.hawkee.com/

;MENUS
menu menubar,status {
  Scripts Monitor
  .Run...:smonitor
  .-
  .Quick View
  ..Show Total Scripts:return $input(Total Scripts Loaded: $script(0),io,QuickView: Total Scripts)
  ..-
  ..Show Basic List (No Paths):return $input(Scripts Currently Loaded: $+ $crlf $+ $crlf $+ $squick,io,QuickView: Basic List)
  ..Show Basic List (With Paths):return $input(Scripts Currently Loaded: $+ $crlf $+ $crlf $+ $squick(1),io,QuickView: Basic List)
  .-
  .Help
  ..About:ddialog sabout
  ..-
  ..ReadMe:do.readme
  .-
  .Unload:$iif($input(Are you sure you want to unload the Scripts Monitor addon?,wy,Confirm Unload),smonitor_unload)
}

;;LOAD EVENTS
ON *:LOAD:var %q = $input(Script Monitor Successfully Loaded! $+ $crlf $+ $crlf Would you like to run it now?,iyvk6,Addon Loaded!) | $iif((%q != $no) && (%q != $timeout),smonitor,return $input(You can run the addon at any time by typing: /smonitor,iok6,Additional Help))

Comments

Sign in to comment.
Dani_l11   -  May 12, 2011

Great script, you should add a change name button. It's easy, just use /rename :D

 Respond  
Zmodem   -  Jun 08, 2009

ES: Thank you! I appreciate the kind words ;)

 Respond  
ES   -  May 30, 2009

This is extremely useful
thx ^^

 Respond  
Zmodem   -  Oct 25, 2008

Hey guys, the script viewer can now display entire full scripts, no matter how long, since mIRC 6.35 added the feature of a Rich Edit box. You must have mIRC 6.35 or higher for this to work for you! :)

 Respond  
Zmodem   -  Oct 18, 2008

Okay, as I've said, the edit boxes are limited in mIRC's dialogs. However, Khaled has recently responded to my post at the mIRC Bug Forum: http://trout.snt.utwente.nl/ubbthreads/ubbthreads.php?ubb=showflat&Number=205274&page=0#Post205274 with this:

"mIRC uses the standard Windows editbox by default in most dialogs, including custom dialogs. The limit for the standard editbox is between 32k and 64k. I'll add support for richedit editboxes in custom dialogs for the next version however, which will allow you to specify an arbitrary limit using the "limit" custom dialog parameter."

Things are lookin' up! :-)

 Respond  
Zmodem   -  Sep 30, 2008

Just to let everyone know, if you're finding that your entire script is not showing, please bear in mind that windows standard edit boxes, not a RICH EDIT which mIRC does NOT use, will not hold more than 64kb of data; this will result in the edit box holding around 655-660 lines of code MAX. However, I've actually ran into a predicament with that statement as well, as I've got 46kb files that will not show either. Unfortunately, this issue cannot be fixed, as it is a direct problem with Windows and mIRC, since Khaled won't use Rich Edit boxes, which store unlimited data. Sorry for any inconvenience!

 Respond  
Zmodem   -  Sep 24, 2008

Well, it's seriously not meant to edit a thing, but with notepad I guess you could. However, I tried what you've said and it did not prove to be problematic for me. I am running on XP, though, so I'm not sure about Wine.

 Respond  
stargazer989   -  Sep 23, 2008

i retract my previous statement... when i save it in Notepad it doesn't wanna load like i saved it. no error messages. i think the script is only unloading it from it's knowledge, i'm probably wrong though.

 Respond  
stargazer989   -  Sep 23, 2008

dude this is awesome!!! running mIRC under Wine can prove problematic with scripts in the Script Editor. i can use this now to edit scripts without having to unload, edit, then reload and bugfix... 11/10!

 Respond  
Zmodem   -  Sep 12, 2008

Thanks! :-)

 Respond  
PuNkTuReD   -  Sep 12, 2008

yip this is awesome. 10/10

 Respond  
irchainscriptz   -  Aug 31, 2008

I have to admit i didnt get any errors and all worked great for me. I think this is a great addon and prefer it better then standard mIRC script editor window. keep up the great work Zmodem and i have to say a 10/10 excellent!!

 Respond  
Zmodem   -  Aug 29, 2008

I have absolutely no idea heh. I'm not getting this trouble with this file loaded anywhere else at all. It shouldn't be an issue with long file names, either, or folders for that matter.

What error are you receiving?

 Respond  
EL   -  Aug 29, 2008

Nah its still cool tho but im runnin into a error involving the dialog versus the file.When i veiw in dialog it doesnt show all contents.any reason why?

 Respond  
Zmodem   -  Aug 28, 2008

Did you read my 'introduction', NIGathan & mascovy? The part where I put:

However, these viewers should never replace the standard mIRC script editor window.

As for why?. Why not? Why do people make auto-joins when there is one in mIRC? Why away systems? Why custom notify lists? It's just fun to create.

 Respond  
mascovy   -  Aug 27, 2008

Hmmm... Nice work for beginner but 'Alt + R' may also work.

 Respond  
NIGathan   -  Aug 27, 2008

Nice script., but may I ask why?

I mean you do see the built in script editor right?

It lets you see all the loaded scripts, view the scripts, unload/load scripts, and pretty much everything you would need to do with a script.

 Respond  
Zmodem   -  Aug 27, 2008

Scakk: Hey, I appreciate that! Thanks for all of your help in testing! :-D

 Respond  
Scakk   -  Aug 27, 2008

It works nicely now. No issues that I can find. Good job on this.

 Respond  
Zmodem   -  Aug 27, 2008

Xpl0reR: If there is one thing I love, it's praise! :-) Thank you so much for the props and I will keep it up! That is, until I run out of ideas ;-)

Thanks again!

 Respond  
xplo   -  Aug 26, 2008

nice fhawkeen Script!!
loved it, use is, share it.

10/10

Keep it up!

 Respond  
Zmodem   -  Aug 26, 2008

Scakk:

Still not able to open any of my scripts using the "View..." button. No error saying why at all.

Unload does not work either. 

Both of these bugs should be fixed now. If it is still persisting, let me know. I have it set to use "QUOTES" around your file names, so even long names should work. I tested this under the name Long Old File Name.mrc and the unload feature worked. I went one step further and put an mIRC and the script into respective long folders C:\New Folder\Secondary New Folder\Long Folder\mIRC\my addons\testing script monitor.mrc and it still unloaded just fine.

As well, loading the files via the View... button should work properly now, almost for the exact same reason as the unload feature not working.

Please let me know if these problems persist.

 Respond  
Scakk   -  Aug 26, 2008

Still not able to open any of my scripts using the "View..." button. No error saying why at all.

Unload does not work either.

 Respond  
Eugenio   -  Aug 26, 2008

Works fine now, thanks for updating and I was glad to test

D

 Respond  
Zmodem   -  Aug 26, 2008

Eugenio:

It still wont unload for me and now I get this error: * /unload: no such file 'Script' (line 10, Script Monitor)

FIXED! Sorry about that! The problem here seemed to be that I forgot about integrating the fact that lfn/long-file-names could be used (ie: needed $+(",fn,").

Thanks again for testing!

 Respond  
Eugenio   -  Aug 26, 2008

It still wont unload for me and now I get this error: * /unload: no such file 'Script' (line 10, Script Monitor)

 Respond  
Scakk   -  Aug 26, 2008

Now it will not open it anywhere. No error messages.

 Respond  
Zmodem   -  Aug 26, 2008
Scakk: Viewing via notepad worls fine for me. However just clicking View does not as it gives me the below error. - loadbuf -ro sviewer 2 %s
  • FIXED!
Eugenio: SMONITOR_UNLOAD Unknown command is the only error I got, apart from that this pwnz.....I like all the helpfull/usefull features aswell like unload script
  • FIXED!

Thanks guys for the bug feedback! :-)

 Respond  
Eugenio   -  Aug 26, 2008

SMONITOR_UNLOAD Unknown command is the only error I got, apart from that this pwnz.....I like all the helpfull/usefull features aswell like unload script
/me rates 8

 Respond  
EL   -  Aug 26, 2008

Yea i get the same as scakk but i get in the viewing dialog:

0&²uŽfϦÙ
0&²uŽfϦÙ
0&²uŽfϦÙ

Neat tho.`-.-´

 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.