Handling a solitary linefeed (`n) in the Edit control

Get help with using AutoHotkey and its commands and hotkeys
afe
Posts: 443
Joined: 06 Dec 2018, 04:36

Handling a solitary linefeed (`n) in the Edit control

19 Apr 2019, 08:33

Hello,

When I paste text containing a solitary linefeed (`n), `r`n pairs is not produced inside the Edit control.
In other words, it won't appear as multiple lines.
How to do If I treat the text after (`n) as the same row or can make it appear as multiple lines?

Such as

Code: Select all

a `nb`r`n                      ; The first row after pasting
cd
I want to treat "a b" as one row and "cd" as another row.
I save it to a variable x with "Gui Submit" and split it using "Loop, Parse, x, `n".

But at this time the value of x will be

Code: Select all

a `nb`n
cd
x[1] = a
x[2] = b
x[3] = cd

I expect to be
x[1] = a b
x[2] = cd

Any good suggestions?
Last edited by afe on 19 Apr 2019, 09:30, edited 1 time in total.
Odlanir
Posts: 372
Joined: 20 Oct 2016, 08:20

Re: Handling a solitary linefeed (`n) in the Edit control

19 Apr 2019, 09:15

Code: Select all

str :="a `nb`r`nCd"
MsgBox % RegExReplace(str, "`n")
____________________________________________________________________________
Windows 7 Home Premium 64 bit - Autohotkey v1.1.24.02 64-bit Unicode
afe
Posts: 443
Joined: 06 Dec 2018, 04:36

Re: Handling a solitary linefeed (`n) in the Edit control

19 Apr 2019, 09:28

But when the Edit control is saved to str via Gui Submit , each `r`n will be translated to a `n.

Return to “Ask For Help”

Who is online

Users browsing this forum: marin87, Odlanir, sumon and 128 guests