0
votes

i want to simulate a Netbeans feature. I want to be able to duplicate the selected LINES. (not the selected text).

I have written the following AutoHotkey macro

DuplicateDown()
{
    SetKeyDelay, -1
    Temp := ClipboardAll
    Clipboard =
    Send {Home}+{End}^c
    ClipWait, 2
    Send {End}{Enter}%Clipboard%
    Clipboard := Temp
}

Problem is that this macro only copies the current line. and i want to be able to copy multiple selected lines.

Can you please advise me how to accomplish this.

1

1 Answers

0
votes

When you have the lines selected upfront and then send {Home}+{End}, don't you force the system to re-select a single line instead of the previously selected mutiple lines?

Here is an example, it does not work with automatic line-breaks though....

#SingleInstance Force
#installKeybdHook
#Persistent
Insert::
    Temp := ClipboardAll
    Clipboard = ""
    Send, ^c
    Sleep, 300
    loop, parse, clipboard, `n
        Jump:=a_index - 1
    Send {End}+{Home}
    Send, +{Up %Jump%}^c
    ClipWait, 2
    Send {Down %Jump%}
    Send, {End}{Enter}^v
    Clipboard := Temp
Return