Jump to content
Sign in to follow this  
E1M1

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

Recommended Posts

E1M1

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

Share this post


Link to post
Share on other sites
bogQ

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.

 

Share this post


Link to post
Share on other sites
E1M1

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

Share this post


Link to post
Share on other sites
E1M1

heh I found it works with window's notepad, but wordpad is the problem :D, but why?


edited

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.