Sign in to follow this  
Followers 0
Pain

Problem with whitespace

3 posts in this topic

#1 ·  Posted (edited)

This is one of my functions that I'm using to get all active TCP and UDP connections.

Func NetStat()
    Local $output
    $Std = Run(@ComSpec & " /c " & "netstat -a", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    
    While 1
        $output &= StdoutRead($Std)
        If @error Then ExitLoop
    Wend    
    
    Return $output
EndFunc

The problem is the output, if I use Run(@ComSpec & " /c " & "netstat -a > stat.txt") I will get a nice list like this

Aktiva anslutningar

  Prot.  Lokal adress                   Extern adress            Status
  TCP   dator:microsoft-ds            localhost:1032            LISTENING
  TCP   dator:1098                    dator:0                  LISTENING
  TCP   dator:1098                    localhost:1032            ESTABLISHED

If I print it with ConsoleWrite it still looks good but if I use GuiCtrlSetData($my_edit_control, NetStat()) it looks like this

Aktiva anslutningar

  Prot.  Lokal adress                       Extern adress            Status
  TCP   dator:microsoft-ds            localhost:1032            LISTENING
  TCP   dator:1098                       dator:0                      LISTENING
  TCP   dator:1098                       localhost:1032         ESTABLISHED
Edited by Pain

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

use a font with fixed letter size in your Edit (e.g. "Lucida Console")

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Thanks alot, I would never have thought about that. :mellow:

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  
Followers 0