Jump to content

[solved] Capture output from external system call?


Recommended Posts

I am trying to execute something like:

C:\WINDOWS\system32>net localgroup administrators
Alias name   administrators
Comment     Administrators have complete and unrestricted access to the computer/domain

Members

-------------------------------------------------------------------------------
Administrator
avery
The command completed successfully.


C:\WINDOWS\system32>

Grab the output and display it in my GUI control.

I did some searches on the forums here and found a way to pipe my RunWait into a text file and just read that back into the au3 app but that takes up a temp file. Is there a better way to do this that anyone is willing to share with me/us?

Please and thanks for reading.

-avery

Edited by avery
www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org
Link to comment
Share on other sites

#include <Process.au3>

MsgBox(0,"",DOS_Output("net localgroup administrators"))

Func DOS_Output($COMMAND)
_RunDOS( $COMMAND  & ">" & @TempDir & "\DOS_Output.dat")
$FILE = FileOpen(@TempDir & "\DOS_Output.dat",0)
$OUT = FileRead($FILE)
FileClose($FILE)
Return $OUT
EndFunc

When the words fail... music speaks.

Link to comment
Share on other sites

  • Developers

I did some searches on the forums here and found a way to pipe my RunWait into a text file and just read that back into the au3 app but that takes up a temp file. Is there a better way to do this that anyone is willing to share with me/us?

Use the StdOutRead() Function.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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