mIRC Home    About    Download    Register    News    Help

Print Thread
#164694 15/11/06 08:42 AM
Joined: Dec 2002
Posts: 252
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
I think it would be cool to have like $editbox(window,0/1,0-x) the 0,1 is obviously 1st or second editbox, and the 0-x is 0 for total lines in memory, and 1+ would return that saved line, when you press up the previous lines up to an extent are there, so a way to access that history via script would be very practical. especially if it worked at returning like $cb, because you can modify stuff in the clipboard to preserve multiple spaces, like add a regsubex to look for multiple spaces and put a ctrl+o in between multiples so even a replacement text event preserves spaces. I dont use a text replacement method because of mulitiple space problems.. reading/pasting, it looks bad.

#164695 15/11/06 09:50 AM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
The only comment I'd make would be to change the parameter order:

$editbox(window,N,E)

Where E (the editbox number) is optional, and defaults to 0.


Sais
#164696 15/11/06 06:50 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
agreed this would be nice, but with your adjustment, editbox number should (must) be last!

#164697 15/11/06 09:10 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
That's partly why I made the change. Plus it would fit with the style of other commands of the same ilk.


Sais
#164698 16/11/06 12:49 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
i think there is some method to access the editbox history actually, or maybe im amagining that, errr actually maybe it was you can load the history up with stuff, but what ever it was it was convoluted using timers and sendkeys and stuff.

#164699 16/11/06 03:27 PM
Joined: Nov 2006
Posts: 26
O
Ameglian cow
Offline
Ameglian cow
O
Joined: Nov 2006
Posts: 26
Code:
/*

$history() by jaytea
returns information about a specific window's editboxes' history

$history(name/@wid,n,c).prop

properties: ctrlenter, inpaste

name is either the window name or window ID
n refers to the nth line in the history of the editbox, n = 0 is the total
c is an optional parameter, if c = 1 it looks at the command editbox

the 'ctrlenter' prop returns $true or $false depending on whether the line
was input with the control key held. with n = 0 it returns the total number
of lines that were input with control held. the other 'inpaste' prop obviously
works in a similar manner

n can also be a negative number, n = 1 is the oldest line and n = -1 is the
most recently input line

note that this only captures lines you press enter for, it doesn't intercept
lines that were typed but were not deleted and not input (even though mirc
still keeps those in the internal history). also, leading/trailing and
duplicate spaces are removed when adding to the hidden window, so clearly
the alias won't return them as they were originally input

*/

on *:input:*:{

  var %max = 50 | ; max number of lines to store per editbox

  var %x = @editboxhistory
  if (!$window(%x)) window -lh %x
  elseif ($fline(%x,$+(/^,$wid \,$cmdbox \S+ \S+ \Q,$replacecs($1-,\E,\E\\E\Q),\E$/),1,2)) dline %x $v1
  elseif ($fline(%x,$wid $cmdbox *,0) == %max) dline %x $fline(%x,$wid $cmdbox *,1)
  aline %x $wid $cmdbox $inpaste $ctrlenter $1-
}

alias history {
  var %wid = $window($iif($1 isnum,@ $+ $1,$1)).wid
  if (%wid) {
    if ($regex($2,/^-?\d+$/)) && ($0 < 4) {
      var %cmd = $istok(1,$3,1), $&
        %x = @editboxhistory
      if ($2) {
        tokenize 32 $line(%x,$fline(%x,%wid %cmd *,$iif($2 < 0,$iif($calc(1 + $fline(%x,%wid %cmd *,0) + $2) > 0,$v1),$2)))
        return $iif($prop == inpaste,$3,$iif($prop == ctrlenter,$4,$5-))
      }
      return $fline(%x,%wid %cmd $iif($prop == inpaste,$true *,$iif($prop == ctrlenter,& $true *,*)),0)
    }
    echo -eac i * Invalid parameters: $!history
  }
  else echo -eac i * $!history: invalid window
} 


codemastr_
#164700 16/11/06 05:29 PM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
yep, i posted that inspired by talon's suggestion laugh


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
#164701 16/11/06 06:08 PM
Joined: Oct 2006
Posts: 166
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
no $regsubex included?! :tongue: (nice code)


Kind Regards, blink

Link Copied to Clipboard