Jump to content

Need Help To Work With External Tools


Recommended Posts

I Wanna use PSTools along with AutoIT so i can use the PSInfo for my project, but how can i get the info from the running PSinfo.exe or how can i retrieve output from PStools?? anyone can help me please :o

Link to comment
Share on other sites

You can redirect the output from almost any console application into a file.

Short example, just hacked it along without testing it :o

#include <process.au3>

$result = _RunDOS("psinfo >" & @TempDir & "\result.txt")

If $result = 0 Then
   $file = FileOpen(@TempDir & "\result.txt", 0)
   While 1
      $line = FileReadLine($file)
      If @error = -1 Then ExitLoop
      Msgbox(0,"Line", $line) 
   Wend
Endif

Hope this helps

Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

The resulting file does always have the same format so you can

skip the first 4 Lines and to reach the interesting lines.

After that I'd suggest something like this (as always, untested ^^)

$position = StringinStr($line,":")
$description = StringStripWS(Stringleft ($line, $position),7)
$value = StringStripWS(StringMid($line, $position+1),7)

to find the ":" in each line and split the entrys into description and value.

Due to the StringstripWS all additional spaces are removed.

Now you'll have to put these entries into the listboxes and continue

till the end of the file :o

best regards

Marc

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

Another way is if you get the latest beta, you can get the output without any temp file. Look up the Run command in the beta help file, and if you want to see a different example check out Send/Check Email using SSL/TLS; POP3 & SMTP in my sig.

EDIT

here is a good simple example of what i'm talking about

http://www.autoitscript.com/forum/index.ph...ndpost&p=156124

Edited by mikeytown2
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...