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

Last edited by MikeChat; 08/12/05 06:51 PM.