Jump to content

StdoutRead I lose line end characters if I use clipput()


Recommended Posts

I am trying to copy cmd output to clipboard but I lose line end characters when I don't use msgbox to display result.Here you can see my script if you run it you will see that msgbox will show text nicely but when you try paste text somewhere, its all one long line.How I could keep line end characters when I copy/paste it?

#include <Constants.au3>
$Wcmd = "ping -a www.neti.ee"
Local $foo = Run(@ComSpec & " /c "&$Wcmd ,  @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $line,$text
For $n = 1 To 3 Step 0
    $line = StdoutRead($foo)
    If @error Then ExitLoop
    $text = $text & $line
Next

MsgBox(0, "STDOUT read:", $text)
ClipPut($text)

Thanks for help!

edited

Link to comment
Share on other sites

I am trying to copy cmd output to clipboard but I lose line end characters when I don't use msgbox to display result.Here you can see my script if you run it you will see that msgbox will show text nicely but when you try paste text somewhere, its all one long line.How I could keep line end characters when I copy/paste it?

#include <Constants.au3>
$Wcmd = "ping -a www.neti.ee"
Local $foo = Run(@ComSpec & " /c "&$Wcmd ,  @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $line,$text
For $n = 1 To 3 Step 0
    $line = StdoutRead($foo)
    If @error Then ExitLoop
    $text = $text & $line
Next

MsgBox(0, "STDOUT read:", $text)
ClipPut($text)

Thanks for help!

if y paste your text in notepad did you try "in notepad" from meny :Format: :Word Pad: to see if itl work better ^^

i did paste in MS Word and i dont have one line problem.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

well I replaced LF with CRLF and then it worked but I can understand why command "help" gets f**ked up then -.-

IF StringInStr ($alltext,@LF)
StringReplace($alltext,@LF,@CRLF)

commands help and dir were displayed correctly before adding these lines above. but If I remove these lines, command "ping -a www.address.com" will not have linebreaks.

I need some other method to make it completable with window's notepad and wordpad.

Thanks

Edited by E1M1

edited

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...