Pasting each line one by one

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
CodingNoob-_-
Posts: 8
Joined: 24 Mar 2021, 12:36

Pasting each line one by one

Post by CodingNoob-_- » 28 Dec 2023, 19:01

Hi! :D I was curious on how to paste each clipboard line by line.

(e.g. clipboard is:
one
two
three
four
five)

^v #1 would be: one (`r)
^v #2 would be: two (`r)
^v #3 would be: three (`r), etc.

I was thinking about doing the following:

1. Get the clipboard on ^v
2. Store the clipboard
3. Get the first line of the clipboard
4. Paste that
5. Get the stored clipboard
6. Remove the first line of the stored clipboard
7. Copy it to clipboard.

Thank you! :D
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Pasting each line one by one

Post by Xtra » 28 Dec 2023, 21:04

Example:

Code: Select all

/*
one
two
three
four
five
*/
~^c::arr := StrSplit(Clipboard, "`n", "`r")

#If (arr.Count() > 0)
^v::Send % arr.RemoveAt(1) . "`n"
#If
Post Reply

Return to “Ask for Help (v1)”