Jump to content

reading from stdin only works with pipes?


 Share

Recommended Posts

Hi,

I tried that example:

http://www.the-coderz.de/Board/AutoIt/ConsoleRead.htm

It works as indicated, but only works when input is piped into the program. If the program is started interactively, it ignores any input. Is there a way to fix that?

I am thinking about calling AutoItX from C, but I'd rather avoid that.

Thanks for your help.

Poupou

Link to comment
Share on other sites

Hi and Welcome to the forums!

Do you mean like a console app? Then check "Create CUI instead of GUI EXE." when compiling.

(I have no idea what you mean otherwise)

;)

Link to comment
Share on other sites

Hi and Welcome to the forums!

Do you mean like a console app? Then check "Create CUI instead of GUI EXE." when compiling.

(I have no idea what you mean otherwise)

;)

Thanks for your quick reply.

Yes, I compiled it as a console application. I did not notice any "Create CUI instead of GUI EXE.". I checked the "Console?" checkbox in the "AutoIt script to exe converter".

It seems my problem is the same as that complaint:

http://www.autoitscript.com/forum/index.php?showtopic=13436&st=0&p=353312&#entry353312

That is to say, if I run:

echo "hello" | test.exe

then, it works very well. But if I run:

test.exe

it does not wait for my input.

Poupou

Link to comment
Share on other sites

Ohh you mean like that. Maybe you can work on this example.

I did not notice any "Create CUI instead of GUI EXE.". I checked the "Console?" checkbox in the "AutoIt script to exe converter".

You're supposed to install SciTE4AutoIt3 (called "AutoIt Script Editor." on the AutoIt download page). Load the script in SciTE and look at the Tools-menu and gasp at all the goodies you get ;) (and gasp again when you try to Compile something!)
Link to comment
Share on other sites

Ohh you mean like that. Maybe you can work on this example.

Thanks for the pointer. In fact, I had already tried it. It works very well in interactive mode. But it does not work at all with a pipe. That is to say, even if the standard input is redirected by a pipe, this function will still read from the console.

I don't want to read from the console, I want to read from standard input, which may be different in case of a pipe.

I tried to replace '_WinAPI_CreateFile("CON", 2, 2)' by '_WinAPI_GetStdHandle(0)', but it does not work either.

There must be a way.

Poupou

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