alias glines {
  ; if the window does not exist: create it. else: clear it
  if ($!window(@gline)) { window -l @glines 300 200 500 400 }
  else { clear @glines } 
  ; and request glines
  .stats g
}
; glines reply: if the glines-window is opened, add the line to the window
; change "11" to whatever color 'default lines' shall have 
raw 223:*: {
  if ($window(@glines)) {
    aline 11 @glines $3
    haltdef
  }
}
; popup in window @glines:
; always allow to "refresh the list"
; if there's at least 1 selected line, allow to "mark" them
; if there's at least 1 selected line, allow to "unmark" them
; if there are any lines in the window, allow to "do things" with all MARKED lines
menu @glines {
  .Refresh glines list : glines
  .$iif(($sline($active,0)),Mark current selection $+([,$v1,]) line(s)) : {
    var %nr = 1
    while ($sline($active,%nr).ln) {
      ; change "4" to whatever color 'marked lines' shall have 
      cline 4 $active $v1
      inc %nr
    }
  }
  .$iif(($sline($active,0)),UnMark current selection $+([,$v1,]) line(s)) : {
    var %nr = 1
    while ($sline($active,%nr).ln) {
      ; the "11" has to be the 'default lines' color
      cline 11 $active $v1
      inc %nr
    }
  }
  .$iif(($line($active,1)),Remove all marked glines) : { 
    var %nr = 1
    while ($line($active,%nr).color) {
      ; the "4" has to be the 'marked lines' color
      if ($v1 == 4) {
        ; add your gline-remove-command (or whatever else to do with all marked glines) here 
        ECHO -tn could now do things with the gline: $line($active,%nr)  
        ; you may want to unmark the processed lines in the window: 
        ECHO -tn could switch the line color back to default: cline 11 $active %nr
        ; OR you may want to remove the processed lines from the window: 
        ECHO -tn could remove the line from $active via: dline $active %nr
      }
      inc %nr
    }
  }
}