I am trying to make simple AHK macro.

What I need is following:

User copies multiple lines of numbers



my code needs to read from clipboard and do following action: 1234{enter} 12345{enter} 12512{enter} 12512{enter} 123123{enter} end.

Number of lines is not set. It should depend on the size of data that is in the clipboard.

Thank you for your help.


Did you even try to look in the AutoHotkey.chm help file of AutoHotkey? It can be opened from the start menu, AHK's taskbar icon menu or the directory where you installed AHK and is very helpful. If you search for "clipboard", first thing that comes up is an example how to split clipboard into lines:

Loop, parse, clipboard, `n, `r
    MsgBox, 4, , File number %A_Index% is %A_LoopField%.`n`nContinue?
    IfMsgBox, No, break

For your use case it must be slightly modified as follows:

#SingleInstance Force
Loop, parse, clipboard, `n, `r
    SendRaw, %A_LoopField%
    Send {Enter}

You can test it in Excel, by comparing F2,SHIFT+Insert and F2, SHIFT+CONTROL+V.

If you want the hotkey to be SHIFT+Insert, change the second line to


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.