Jump to content
Sign in to follow this  
DarkBoost

StdoutRead + ConsoleWrite works but ArrayAdd does not

Recommended Posts

DarkBoost

As the title suggests. I am trying to write the data from a command prompt to an array... in the console the results are listed perfectly but in the array it is not. Any suggestions?

#include <Constants.au3>
#include <Array.au3>

Dim $run, $results, $array[1]

$run = Run(@ComSpec & " /c dir c:\windows\*.exe /b", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

While 1
    $results = StdoutRead($run)
    If @error Then ExitLoop
    ConsoleWrite($results)
    _ArrayAdd($array, $results)
Wend

_ArrayDisplay($array)

post-24114-0-27477400-1292904018_thumb.j

Share this post


Link to post
Share on other sites
DarkBoost

I'm not sure how to explain what you are doing wrong, but here's the code to do it right.

haha i love this line... i want to pin this up at work :x

thanks this has worked perfectly!

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  

×