Jump to content

Display only upto 3 lines from output


BigAl
 Share

Go to solution Solved by mikell,

Recommended Posts

Hello
 
I have a small app which runs some machine configuration, stops and disables taks etc and outputs the STDOUT into a variable, then using StringRegExpReplace I remove the blanks lines from the output and then display the this in an Edit control.
This works in that it will show me the entire output but I only want to display upto the first 3 lines in my Edit Control.
 
I've googled a few option but not really sure what would be the best way to go about it.
 
I've posted a snippet below which shows the task stopping and how i remove the blank lines

Local $superstop = Run(@ComSpec & " /c " & 'sc stop "' & "SysMain" & '"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
   ProcessWaitClose($superstop)
   $superout = StdoutRead($superstop)
   $superoutNBL = StringRegExpReplace(StringRegExpReplace($superout, "(\v)+", @CRLF), "\A\v|\v\Z", "")
   GUICtrlSetData($Output, GUICtrlRead($Output)& @CRLF & @HOUR & ":" & @MIN & ":" & @SEC & " " & "$superoutNBL$")

Any help would be appreciated.

 

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...