Reversing text selection or clipboard

Discussion, questions and support.
Post Reply
User avatar
Oblomov
Posts: 185
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Feb 15th, ’20, 13:50

I'm trying to figure out how to reverse a selection or clipboard.

According to this thread
viewtopic.php?f=4&t=1079&p=3960&hilit=reverse#p3960

This should be used

Code: Select all

sort, clipboard, R
And it seems to work with numbers. However, when wanting to reverse these couple of lines
interconnected
connects the threads
part of the mainstream
anyone could watch
international culture
bedrock of marvel
building something
I get this instead
part of the mainstream
international culture
interconnected
connects the threads
building something
bedrock of marvel
anyone could watch
Which seems a little scrambled... I tried checking AutoHotkey forums, but nothing useful so far 😞
User avatar
Tom
Posts: 796
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 15th, ’20, 17:19

Sort command sorts the items in alphabetical order so the result is ok.

If you want to reverse the lines order then somethig like this should work:

Code: Select all

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Msgbox, % result
User avatar
Oblomov
Posts: 185
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Feb 15th, ’20, 20:04

Tom wrote: Feb 15th, ’20, 17:19 Sort command sorts the items in alphabetical order so the result is ok.

If you want to reverse the lines order then somethig like this should work:

Code: Select all

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Msgbox, % result
That's just what I was looking for, thanks! Is there any way to have it be saved inside of clipboard rather than an FK window however?

Image
User avatar
Tom
Posts: 796
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 15th, ’20, 21:52

Code: Select all

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
User avatar
Oblomov
Posts: 185
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Feb 15th, ’20, 22:03

Tom wrote: Feb 15th, ’20, 21:52

Code: Select all

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
Thanks! I think right now it just aggregates the commands without clearing them however 🤔

Code: Select all

asd
has
sas
asd
has
sas
sas
has
asd
sas
has
asd

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
Clipboard:=Result
	result := A_LoopField "`n" result
Loop Parse, Clipboard, `n, `r

sas
has
asd
sas
has
asd
asd
has
sas
asd
has
sas

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
Clipboard:=Result
	result := A_LoopField "`n" result
Loop Parse, Clipboard, `n, `r

asd
has
sas
asd
has
sas
sas
has
asd
sas
has
asd

Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
Clipboard:=Result
	result := A_LoopField "`n" result
Loop Parse, Clipboard, `n, `r
User avatar
Tom
Posts: 796
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 17th, ’20, 10:32

Code: Select all

result:=""
Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
:?:
User avatar
Oblomov
Posts: 185
Joined: Mar 4th, ’19, 19:44

Post by Oblomov » Feb 17th, ’20, 19:44

Tom wrote: Feb 17th, ’20, 10:32

Code: Select all

result:=""
Loop Parse, Clipboard, `n, `r
	result := A_LoopField "`n" result
Clipboard:=Result
:?:
This fixed it, thanks! ❤
Post Reply