mIRC Home    About    Download    Register    News    Help

Topic Options
#197896 - 16/04/08 08:49 AM help gline windows
TheWarlock Offline
Vogon poet

Registered: 24/11/07
Posts: 117
i made a small prog to ugline

; addon glines

alias glines { .stats g | /window @gline 300 200 500 400 }

raw 223:*: { .aline @gline $1- | haltdef }

how i read the selected lines ??

thnx

Top
#197899 - 16/04/08 10:18 AM Re: help gline windows [Re: TheWarlock]
Horstl Offline
Hoopy frood

Registered: 03/11/06
Posts: 1559
Loc: Germany
Use the -l switch to create a listbox-window (/help /window).
Then, in a listbox window, you can use the $sline(@Name,N) identifier.

Top
#197910 - 16/04/08 04:43 PM Re: help gline windows [Re: Horstl]
TheWarlock Offline
Vogon poet

Registered: 24/11/07
Posts: 117
; addon glines

alias glines { .stats g | /window -lne @gline 300 200 500 400 }

raw 223:*: { .aline @gline $3 | haltdef }


menu @gline {
.Gline List : .stats g
.Ungline : //echo -a gline -+ %choice
.Clear : .clear @gline
.linea : .aline 4 @gline $sline(@gline,1)
.linea2 : set %choice $line(@gline,1)
}

alias aca {
.aline -e @gline $sline(@gline,0).ln
}

Top
#197915 - 16/04/08 06:35 PM Re: help gline windows [Re: TheWarlock]
Horstl Offline
Hoopy frood

Registered: 03/11/06
Posts: 1559
Loc: Germany
Hum, just guessing what you want to do:
Code:
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
    }
  }
}

Notes:
- refer to the content of a $sline (e.g. do things with the data it contains) with $sline(@window,N)
- refer to the line number of a $sline (e.g. do things with the line itself) via $sline(@window,N).ln
- as there may be a multiple selection, loop the N of $slines using while. In the example above, I did the same with all colored=marked lines in the 'do things with selected lines' part.

...Hope it helps smile

Top
#197937 - 17/04/08 03:54 AM Re: help gline windows [Re: Horstl]
TheWarlock Offline
Vogon poet

Registered: 24/11/07
Posts: 117
thnx so much , bro , i have 2 errors

Top
#197964 - 17/04/08 07:56 PM Re: help gline windows [Re: TheWarlock]
Horstl Offline
Hoopy frood

Registered: 03/11/06
Posts: 1559
Loc: Germany
(?) confused
What kind of errors? Where?
We can only (try to) help if we're given some info...

Top