mIRC Homepage

Ooops...too many scripts

Posted By: RusselB

Ooops...too many scripts - 08/12/05 07:59 AM

I've got about 50 scripts in different directories, and I know some of them are updated versions of others..the problem is, that sometimes the updated versions are quite different from the original (eg: original worked in any channel, update will work across multiple channels and/or multiple networks)

Aside from doing a visual comparison between the different scripts, any suggestions as to how I could eliminate the unnecessary scripts?

I really don't want to have to print them all, as I figure I'd need about 530 pages to print them all.
Posted By: MikeChat

Re: Ooops...too many scripts - 08/12/05 05:22 PM

I didnt test this but all that it does is check the creat time for a file
you might want to use "last edited time" too
Code:
dialog mrc-sort {
Title "Choose MRC Version"
size -1 -1 300 100
option dbu
list 100, 5 20 290 50, sort
button "Delete", 900, 125 55 50 20
}
on *:dialog:mrc-sort:init:0:{
var %null = $findfile($mircdir,*.mrc,0,mrcprop $1-)
}
alias mrcprop {
did -a mrc-sort 100 $nopath($1-) Created $asctime($file($1-).ctime) : $1-
}
on *:dialog:mrc-sort:sclick:900:{
var %fullfile = $gettok($did(mrc-sort,100),2,58)
var %check = $input(Are You Sure?,y)
if (%check == $true) { remove $+(",%fullfile,") }
}


again, I didnt test it yet
Last modified: $asctime($file($1-).mtime)

Edit: I was missing a : on the init section
Posted By: MikeChat

Re: Ooops...too many scripts - 08/12/05 06:11 PM

I added a check for loaded, this is slow so maby someone has a better way to do it:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;
;;  List all MRC Files ;;
;; and Delete Unwanted ;;
;; by MikeChat 12/8/05 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;

alias mrc-sort { dialog -dm mrc-sort mrc-sort }
dialog mrc-sort {
  Title "Choose MRC Version"
  size -1 -1 300 100
  option dbu
  list 100, 5 20 290 50, sort
  button "Delete", 900, 125 75 50 20
}
on *:dialog:mrc-sort:init:0:{
  var %null = $findfile($mircdir,*.mrc,0,mrcprop $1-)
}
alias mrcprop {
  did -a mrc-sort 100 $nopath($1-) $itsloaded($1-) Created $asctime($file($1-).ctime)  $1-
}
on *:dialog:mrc-sort:sclick:900:{
  var %fullfile = $gettok($did(mrc-sort,100).seltext,2,0144)
  var %check = $input(Are You Sure?,y)
  if (%check == $true) { 
    if ($itsloaded(%fullfile) == Loaded) { unload -rs $nopath(%fullfile) }
    remove %fullfile
    did -d mrc-sort 100 $did(mrc-sort,100).sel
  }
}
alias itsloaded {
  var %isload = $1-
  var %i = 1
  while (%i <= $script(0)) { 
    if ($script(%i) == %isload) { var %itsloaded = Loaded }
    inc %i
  }
  if (%itsloaded == $null) { var %itsloaded = Not Loaded }
  return %itsloaded
}


Edit: Changed the get token to $char(0144) as useing : wont work (duh!)
also changed the $+"(",%fullfile,") because it errored, just %fullfile now
and in the unload its $nopath to unload correctly
Added Remove the line when its deleted
Posted By: MikeChat

Re: Ooops...too many scripts - 09/12/05 04:41 AM

I have played with this a bit more, as its something I can use

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;
;;  List all MRC Files ;;
;; and Delete Unwanted ;;
;; by MikeChat 12/8/05 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;

alias mrc-sort { dialog -dm mrc-sort mrc-sort }
dialog mrc-sort {
  Title "Choose MRC Version"
  size -1 -1 300 100
  option dbu
  list 100, 5 5 290 50, sort
  button "Delete", 900, 125 65 50 20
}
on *:dialog:mrc-sort:init:0:{
  var %null = $findfile($mircdir,*.mrc,0,mrcprop $1-)
}
alias mrcprop {
  did -a mrc-sort 100 $nopath($1-) $itsloaded($1-) Last Modified $asctime($file($1-).mtime) $+  $+ $1-
}
on *:dialog:mrc-sort:sclick:900:{
  var %fullfile = $gettok($did(mrc-sort,100).seltext,2,0144)
  var %check = $input(Are You Sure?,y)
  if (%check == $true) { 
    if ($itsloaded(%fullfile) == Loaded) { unload -rs %fullfile }
    remove -b $+(",%fullfile,")
    did -d mrc-sort 100 $did(mrc-sort,100).sel
  }
}
alias itsloaded {
  var %isload = $1-
  var %i = 1
  while (%i <= $script(0)) { 
    if ($script(%i) == %isload) { var %itsloaded = Loaded }
    inc %i
  }
  if (%itsloaded == $null) { var %itsloaded = Not Loaded }
  return %itsloaded
}


let me know if this is close to what you wanted.
Posted By: RusselB

Re: Ooops...too many scripts - 09/12/05 05:04 AM

Thanks for your help, Mike...Unfortunately it's looking more & more like I'll have to do this the hard way, as I need to compare a section in one script with a similar (or identical) section in one or more other scripts. Also not all of the script files are located in my main mIRC directory.

I've got a bit of a bad habit of writing code for someone else, saving it with the default name if it's something I might use.

So I've got multiple files with the same name, even though the scripts themselves might be very different.
Posted By: MikeChat

Re: Ooops...too many scripts - 09/12/05 05:27 AM

hmm
Code:
alias viewmrcs {
  window -ado @mrc 1 1 500 300
  var %filename2check = $nopath($sfile(*.mrc)) 
  var %null = $findfile(c:,%filename2check,0,load2win $1-)
}
alias load2win {
  aline @mrc 4 $1-
  aline @mrc 4 Last Modified $asctime($file($1-).mtime)
  loadbuf @mrc $1-
}

menu @mrc {
  dclick:remove -b $line(@viewmrc,$sline(@viewmrc).ln)
}


It [b][i]has[b][i] been a while since I have used menus in @windows
© 2019 mIRC Discussion Forums