mIRC Home    About    Download    Register    News    Help

Print Thread
O
Othello
Othello
O
Is there a simpler liine I could use to copy the whole line from a custom window?

Copy : clipboard $mid($sline(@TEST,1),1,$calc($pos($sline(@TEST,1),.,1) + 60))

Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
If you just want to copy the selected line to clipboard, "clipboard $sline(@test,1)" would do the job, but judging from your code it looks like you are trying to do something else aswell..

H
Hammer
Hammer
H
Code:

  Copy : clipboard $mid($sline(@TEST,1),1,$calc($pos($sline(@TEST,1),.,1) + 60))

That popup literally means this, when clicked:
  • Copy to the clipboard
  • the first selected line in the @TEST window,
  • starting from the first character
  • continuing through 60 characters past the first period on the line.
Collective's answer is most likely exactly what you are looking for.
Code:

  Copy: clipboard $sline(@Test,1)

This version means, when clicked:
  • Copy to the clipboard
  • the first selected line in the @Test window.
Stopping here is exactly what you asked for. Where did you get that first example from? It's pretty specific for a simple copy to clipboard command. Since you have found the /window command and therefore, the /help /window command, scroll down to the very bottom where the @Window $identifiers are described and read up on $sline().

O
Othello
Othello
O
What I was trying to achieve was to copy selected lines in a custom window This line is one that was used in another script I have that did the same thing.

H
Hammer
Hammer
H
If you can select multiple lines in your window and want to be able to copy all of them to your clipboard, you need to loop through the lines and add a $crlf between them. Like this:
Code:

  Copy :{
  
    ;  Copy the first line to the clipboard without a $crlf (in case there's only just the one line selected
    ;  and not using the -a switch because we want to overwrite (initially) what's on the clipboard.
    clipboard $sline(@TEST,1)
  
    ;  Now get ready to loop through the rest of the lines, if there are any.
    var %i
    while ($sline(@TEST,%i)) {

      ;  Since we've made it into the loop, we must have found another line to add. Add a $crlf 
      ; (carriage return/line feed) to get to the next line and then the text found on the next line.
      ;  Copy it to the clipboard, this time using the -a switch to add it to what's already there.
      clipboard -a $+($crlf,$ifmatch)
  
      ;  Increment %i to see if there is another line.
      inc %i
  
    }
  }

Your lines are now on your clipboard, ready to be pasted somewhere (with Alt-V or using $cb or however you want to access them).


Link Copied to Clipboard