E1M1 Posted April 8, 2009 Share Posted April 8, 2009 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 More sharing options...
bogQ Posted April 8, 2009 Share Posted April 8, 2009 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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 More sharing options...
E1M1 Posted April 8, 2009 Author Share Posted April 8, 2009 (edited) 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 April 8, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
E1M1 Posted April 8, 2009 Author Share Posted April 8, 2009 heh I found it works with window's notepad, but wordpad is the problem , but why? edited Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now