Send () add new lines for no reason

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
xMaxrayx
Posts: 172
Joined: 06 Dec 2022, 02:56
Contact:

Send () add new lines for no reason

Post by xMaxrayx » 08 Jun 2023, 07:48

Hi, I used Send input, Send, and Send text, and all of them add new lines for no reason.


but if I saved it to A-Clipboard and I used send ^v it won't cause any issue

Code: Select all

^q::
{   
    gg := ""
    A_Clipboard := ""
    Send "^c"
    if !ClipWait(0.2,0)
        {
            MsgBox ("There is no text!")
            return
        }
     gg := ("[quote]" . A_Clipboard . "[/quote]")
     A_Clipboard := gg
     Send "^v"
    
    
    return
}
result

Code: Select all

[quote]aaa
aaaa
aaaa
[/quote]










send, send input ,send text mothed (bad result ,new lines)

Code: Select all

^q::
{   
    gg := ""
    A_Clipboard := ""
    Send "^c"
    if !ClipWait(0.2,0)
        {
            MsgBox ("There is no text!")
            return
        }
     gg := ("[quote]" . A_Clipboard . "[/quote]")
     ;A_Clipboard := gg
     Send (gg)
    
    
    return
}
result

Code: Select all

[quote]aaa

aaaa

aaaa
[/quote]

User avatar
mikeyww
Posts: 27072
Joined: 09 Sep 2014, 18:38

Re: send command don't add new lines for no reason

Post by mikeyww » 08 Jun 2023, 08:50

Text mode:
`n, `r and `r`n are all translated to a single Enter, unlike the default behavior and Raw mode, which translate `r`n to two Enter.

Code: Select all

#Requires AutoHotkey v2.0
txt := 'a`r`nb`r`nc'
Send txt
SendText txt

Post Reply

Return to “Ask for Help (v2)”