Sign in to follow this  
Followers 0
Elkie

Need Help To Work With External Tools

8 posts in this topic

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

Share this post


Link to post
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


It's my job to comfort the disturbed and to disturb the comfortable.

Share this post


Link to post
Share on other sites

awesome, it works thanks alot man. Now just need top figure out how to take only those values to display 'em on each textbox, got any idea?

Share this post


Link to post
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


It's my job to comfort the disturbed and to disturb the comfortable.

Share this post


Link to post
Share on other sites

K k i'm gonna give a try, thanks again for the help mate!!!

Share this post


Link to post
Share on other sites

trids: am i missing something, i download the script and folow the directions but all of the output is just the result of net view?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

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