Jump to content

Vista and STDOUT


Recommended Posts

Seems all my scripts are broken!

Fault appears to be running on Vista, the

RUN(@comspec & ' /c xyz....... , @sw_hide,$STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($process)
    If @error Then ExitLoop
Wend

There is more code in the while wend loop to analyse the output of the command line and do certain things, under all OS's its fine except vista where $line is permanently empty (script never gets the console output) and so the loop never ends and the app doesnt work because you can't get the console output and act on it!

Link to comment
Share on other sites

Oh, by the way, i was asking for help!!!! If anyone has an answer.

Only thing I can think of is output the console to text and read the text file, but thats a bit pants

Seems all my scripts are broken!

Fault appears to be running on Vista, the

RUN(@comspec & ' /c xyz....... , @sw_hide,$STDERR_CHILD + $STDOUT_CHILD)

While 1
    $line = StdoutRead($process)
    If @error Then ExitLoop
Wend

There is more code in the while wend loop to analyse the output of the command line and do certain things, under all OS's its fine except vista where $line is permanently empty (script never gets the console output) and so the loop never ends and the app doesnt work because you can't get the console output and act on it!

Link to comment
Share on other sites

Hi all

First your run command is totally messed up right now but I'm guessing you typed that as a concept example :whistle:

I tested this exact code in Vista Business NL 32 bits and it works like a charm:

#include <Constants.au3>

$process = RUN(@comspec & " /c dir c:\","",@sw_hide,$STDOUT_CHILD)

Do
    $line = StdoutRead($process)
    MsgBox(0,"test","line: "&$line)
    If @error Then ExitLoop
Until $line=""

Seems like the Stdoud behaves exactly like you would expect it to.

BUT... I disabled UAC before. Maybe that's the issue. I'll need to reboot my Vista laptop now to ENable UAC and then I'll retry.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

BUT... I disabled UAC before. Maybe that's the issue. I'll need to reboot my Vista laptop now to ENable UAC and then I'll retry.

No, that's not it. I rebooted Vista with UAC enabled, and this script still returns the DIR output like it should. You sure your command actually gives standard output in Vista? Maybe it's not the reading of the Stdout by your script, but the StdOut outputting by your source.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

No, that's not it. I rebooted Vista with UAC enabled, and this script still returns the DIR output like it should. You sure your command actually gives standard output in Vista? Maybe it's not the reading of the Stdout by your script, but the StdOut outputting by your source.

try output from RASDIAL
Link to comment
Share on other sites

try output from RASDIAL

Tried it. Returns two lines perfectly ok. Exact code used for testing:

#include <Constants.au3>

$process = Run(@comspec & " /c rasdial","",@sw_hide,$STDOUT_CHILD)

Do
    $line = StdoutRead($process)
    MsgBox(0,"test","line: "&$line)
    If @error Then ExitLoop
Until $line=""

Lines returned:

Geen verbindingen (<-- no connections)

Opdracht voltooid. (<-- command completed)

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Under XP your script returns

No connections

Command Completed

OK

Under Vista it does

No Connections

OK

Command Completed

OK

But it does work, mine works perfectly on XP/2000 but not vista

$process = Run(@ComSpec & ' /C ' & 'rasdial ' &chr(34) & 'Qual-IT Connect!' & chr(34) & ' ' & $username & ' ' & $password & ' /PHONE:' & $ipaddress & ' /PHONEBOOK:' & @TempDir & '\' & $phonebook, @scriptdir, @sw_show,$STDERR_CHILD + $STDOUT_CHILD)

GuiCtrlSetData ($Progress_1, 80) ; set a real progress bar based on the qty of files to download

$connect=0

While 1

$line = StdoutRead($process)

If @error Then ExitLoop

$findit=StringInStr ( $line, "Successfully connected" )

if $findit <> 0 Then $connect=1

if $connect = 0 then

GuiDelete ($prog)

connect()

return ' '

endif

Wend

Traytip ($appname, "Connected to " & $ipaddress,20)

GuiDelete ($prog)

EndFunc

Tried it. Returns two lines perfectly ok. Exact code used for testing:

#include <Constants.au3>

$process = Run(@comspec & " /c rasdial","",@sw_hide,$STDOUT_CHILD)

Do
    $line = StdoutRead($process)
    MsgBox(0,"test","line: "&$line)
    If @error Then ExitLoop
Until $line=""

Lines returned:

Geen verbindingen (<-- no connections)

Opdracht voltooid. (<-- command completed)

Link to comment
Share on other sites

But it does work, mine works perfectly on XP/2000 but not vista

Hmm... Can't test your exact code without your data and the rest of your code ofcourse, but:

1 - Where does it go wrong and what happens?

2 - If you run the exact command from a command prompt, does it actually produce output under Vista? (Just asking to be sure. This because you say yourself that the rasdial output without parameters does actually make this script work on your system, so I'm still suspecting a difference in output from your command in different Windows versions...)

/edit: typo

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

I think i'll have to play

Im not imagining things, the script is fukt under vista, its been running for several clients for a year on xp/2000

I've got it to kind of work under vista, ish -

after rasdial the output should be if successful "connected" - i never get that from stdout

but if i put it in a loop and run the command again i do get "already connected" which i can act on

not ideal but i'll keep playing

again, scripts work very well on xp/2k so something is different here

its a clean install of vista ultimate rtm

nice, on my 512meg laptop task manager shows 0k free with just the OS running!

Hmm... Can't test your exact code without your data and the rest of your code ofcourse, but:

1 - Where does it go wrong and what happens?

2 - If you run the exact command from a command prompt, does it actually produce output under Vista? (Just asking to be sure. This because you say yourself that the rasdial output without parameters does actually make this script work on your system, so I'm still suspecting a difference in output from your command in different Windows versions...)

/edit: typo

Link to comment
Share on other sites

nice, on my 512meg laptop task manager shows 0k free with just the OS running!

I have 532 MB in use of 1 GB total :whistle: Could be right.

But anyway, I *MIGHT* have found something Vista-related that might interest you. I posted a question about Vista access a couple of days ago but did not get any answer... After some developer research I found my answer, don't know if it helps but it never hurts to try. See my thread: http://www.autoitscript.com/forum/index.php?showtopic=42213

Cheers.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

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